-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.html
More file actions
426 lines (423 loc) · 18 KB
/
README.html
File metadata and controls
426 lines (423 loc) · 18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>README</title>
<style>
html {
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
margin: 0 auto;
max-width: 36em;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 12px;
}
h1 {
font-size: 1.8em;
}
}
@media print {
html {
background-color: white;
}
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
svg {
height: auto;
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
font-size: 85%;
margin: 0;
hyphens: manual;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
border: none;
border-top: 1px solid #1a1a1a;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
#TOC li {
list-style: none;
}
#TOC ul {
padding-left: 1.3em;
}
#TOC > ul {
padding-left: 0;
}
#TOC a:not(:hover) {
text-decoration: none;
}
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; }
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
code span.at { color: #7d9029; }
code span.bn { color: #40a070; }
code span.bu { color: #008000; }
code span.cf { color: #007020; font-weight: bold; }
code span.ch { color: #4070a0; }
code span.cn { color: #880000; }
code span.co { color: #60a0b0; font-style: italic; }
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
code span.do { color: #ba2121; font-style: italic; }
code span.dt { color: #902000; }
code span.dv { color: #40a070; }
code span.er { color: #ff0000; font-weight: bold; }
code span.ex { }
code span.fl { color: #40a070; }
code span.fu { color: #06287e; }
code span.im { color: #008000; font-weight: bold; }
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
code span.kw { color: #007020; font-weight: bold; }
code span.op { color: #666666; }
code span.ot { color: #007020; }
code span.pp { color: #bc7a00; }
code span.sc { color: #4070a0; }
code span.ss { color: #bb6688; }
code span.st { color: #4070a0; }
code span.va { color: #19177c; }
code span.vs { color: #4070a0; }
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
</style>
</head>
<body>
<header id="title-block-header">
<h1 class="title">README</h1>
</header>
<h1 id="visionengine">VisionEngine</h1>
<p>Computer-vision + LLM-vision toolkit for UI analysis and
navigation-graph construction. Decoupled from any consuming project per
CONST-051(B); incorporated by HelixCode + HelixQA as an equal-codebase
submodule per CONST-051(A).</p>
<h2 id="overview">Overview</h2>
<p>VisionEngine provides four cooperating layers:</p>
<ul>
<li><strong>Analyzer</strong> (<code>pkg/analyzer</code>) —
<code>Analyzer</code> interface, <code>VideoProcessor</code> interface,
value types (<code>UIElement</code>, <code>ScreenAnalysis</code>,
<code>ScreenDiff</code>, <code>Rect</code>, <code>Size</code>,
<code>TextRegion</code>, <code>VisualIssue</code>,
<code>ScreenIdentity</code>, <code>Action</code>,
<code>KeyFrame</code>), <code>StubAnalyzer</code> reference
implementation with CONST-046 i18n seam.</li>
<li><strong>NavigationGraph</strong> (<code>pkg/graph</code>) — directed
graph for tracking app screen transitions with BFS pathfinding, three
export back-ends (DOT, JSON, Mermaid), plus stress / automation /
integration / security test suites.</li>
<li><strong>LLM Vision providers</strong> (<code>pkg/llmvision</code>) —
<code>VisionProvider</code> interface and adapters for OpenAI (GPT-4o),
Anthropic (Claude), Gemini, Qwen-VL, Kimi, StepGUI, Astica, Ollama;
<code>FallbackChain</code> composer.</li>
<li><strong>Configuration</strong> (<code>pkg/config</code>) — env-var
loader + validator with every user-facing error string routed through
<code>pkg/i18n.Translator</code>.</li>
</ul>
<p>Build-tag gating: <code>pkg/opencv</code> ships stubs in the default
build path and real GoCV bindings under <code>-tags vision</code>. The
rest of the module is buildable + testable WITHOUT OpenCV on any Go
1.25.3+ host.</p>
<h2 id="quick-start">Quick start</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Run tests (no OpenCV required)</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> test <span class="at">-race</span> <span class="at">-count</span><span class="op">=</span>1 ./...</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Build</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> build ./...</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="co"># With OpenCV support</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> build <span class="at">-tags</span> vision ./...</span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a><span class="co"># Exercise the public surface end-to-end with the round-297 runner</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> run ./challenges/runner/</span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a><span class="co"># Paired-mutation Challenge (anti-bluff proof — see CONST-035)</span></span>
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a><span class="ex">./challenges/scripts/visionengine_describe_challenge.sh</span> <span class="co"># exit 0 (normal)</span></span>
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a><span class="ex">./challenges/scripts/visionengine_describe_challenge.sh</span> <span class="at">--mutate</span> <span class="co"># exit 99 (mutation detected)</span></span></code></pre></div>
<h2 id="packages">Packages</h2>
<table>
<thead>
<tr>
<th>Package</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>pkg/analyzer</code></td>
<td><code>Analyzer</code> interface, value types,
<code>StubAnalyzer</code> reference impl, CONST-046 Translator seam</td>
</tr>
<tr>
<td><code>pkg/graph</code></td>
<td><code>NavigationGraph</code> with BFS <code>PathTo</code>,
<code>ExportDOT</code> / <code>ExportJSON</code> /
<code>ExportMermaid</code>, full test matrix</td>
</tr>
<tr>
<td><code>pkg/llmvision</code></td>
<td><code>VisionProvider</code> + 9 cloud / local adapters (OpenAI,
Anthropic, Gemini, Qwen, Kimi, StepGUI, Astica, Ollama) +
<code>FallbackChain</code></td>
</tr>
<tr>
<td><code>pkg/opencv</code></td>
<td>OpenCV stubs (default) + real GoCV bindings behind
<code>-tags vision</code></td>
</tr>
<tr>
<td><code>pkg/config</code></td>
<td>Env-driven configuration loader + i18n-routed validation</td>
</tr>
<tr>
<td><code>pkg/i18n</code></td>
<td>Minimal dependency-free <code>Translator</code> interface +
<code>NoopTranslator</code> standalone default</td>
</tr>
<tr>
<td><code>pkg/remote</code></td>
<td><code>VisionPool</code> SSH wiring for distributed vision workers
(round-40 anti-bluff close-out at commit <code>8dbf6fd</code>)</td>
</tr>
</tbody>
</table>
<h2 id="navigationgraph-most-imported-by-helixqa">NavigationGraph
(most-imported by HelixQA)</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode go"><code class="sourceCode go"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>g <span class="op">:=</span> graph<span class="op">.</span>NewNavigationGraph<span class="op">()</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>g<span class="op">.</span>AddScreen<span class="op">(</span>analyzer<span class="op">.</span>ScreenIdentity<span class="op">{</span>ID<span class="op">:</span> <span class="st">"home"</span><span class="op">,</span> Name<span class="op">:</span> <span class="st">"Home"</span><span class="op">})</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>g<span class="op">.</span>AddScreen<span class="op">(</span>analyzer<span class="op">.</span>ScreenIdentity<span class="op">{</span>ID<span class="op">:</span> <span class="st">"settings"</span><span class="op">,</span> Name<span class="op">:</span> <span class="st">"Settings"</span><span class="op">})</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a>g<span class="op">.</span>AddTransition<span class="op">(</span><span class="st">"home"</span><span class="op">,</span> <span class="st">"settings"</span><span class="op">,</span> analyzer<span class="op">.</span>Action<span class="op">{</span>Type<span class="op">:</span> <span class="st">"click"</span><span class="op">,</span> Target<span class="op">:</span> <span class="st">"gear"</span><span class="op">})</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a>g<span class="op">.</span>SetCurrent<span class="op">(</span><span class="st">"home"</span><span class="op">)</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a>path<span class="op">,</span> _ <span class="op">:=</span> g<span class="op">.</span>PathTo<span class="op">(</span><span class="st">"settings"</span><span class="op">)</span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a>fmt<span class="op">.</span>Println<span class="op">(</span>graph<span class="op">.</span>ExportMermaid<span class="op">(</span>g<span class="op">))</span></span></code></pre></div>
<h2 id="anti-bluff-guarantees">Anti-bluff guarantees</h2>
<p>VisionEngine is governed by Article XI §11.9 + CONST-035: every PASS
in this module's test + Challenge suites MUST carry positive runtime
evidence captured during execution.</p>
<ol type="1">
<li><strong>No mocks beyond unit tests</strong> (CONST-050(A)).
<code>pkg/analyzer/stub.go</code> is the canonical reference
implementation, not a placeholder. The round-297 challenge runner
(<code>challenges/runner/main.go</code>) constructs real
<code>StubAnalyzer</code> + <code>NavigationGraph</code> instances and
asserts on real return values; no test double substitutes for the public
API.</li>
<li><strong>Negative-path assertions are mandatory.</strong>
<code>AnalyzeScreen(nil)</code> MUST return
<code>analyzer.ErrEmptyScreenshot</code>; runner check 2 fails the whole
Challenge if the sentinel is missing or wrong.</li>
<li><strong>5-locale bilingual evidence</strong> per CONST-046. Every
captured runner line carries <code>[en | sr | ja | de | es]</code>
labels so artefacts cannot be English-only smoke. The locale strings
live in the runner (a consumer of the module), NOT inside
<code>pkg/</code>, so the module itself stays language-agnostic.</li>
<li><strong>Paired-mutation Challenge</strong>
(<code>visionengine_describe_challenge.sh --mutate</code>). The script
plants a deliberate regression in a scratch copy of
<code>pkg/graph/graph.go</code> (zeroing <code>AddTransition</code>) and
asserts the runner FAILs. If the runner spuriously passes on mutated
source, the Challenge is itself a bluff and exits 2 to flag it. Normal
mode exits 0, mutate mode exits 99 — these are the canonical round-220
paired-mutation codes.</li>
<li><strong>CONST-046 Translator seam.</strong> Every user-facing string
(<code>AnalyzeScreen</code> Title/Description, config validation errors,
<code>FallbackChain</code> error wrappers, provider validation errors)
resolves through <code>pkg/i18n.Translator</code>.
<code>NoopTranslator</code> (the standalone-default) returns the msgID
verbatim so the call site falls back to its bundled English fixture —
keeping the module project-not-aware per CONST-051(B).</li>
<li><strong>CONST-051(B) decoupling.</strong> The module imports nothing
from HelixCode / HelixQA / any consuming project. Verify:
<code>! grep -r 'helix_code\|helixqa\|HelixCode\|HelixQA' pkg/ go.mod</code>.</li>
<li><strong>Symbol→test ledger</strong> at
<code>docs/test-coverage.md</code> maps every exported symbol in
<code>pkg/{analyzer,graph,llmvision,opencv,config,i18n,remote}</code> to
the test (or Challenge) that exercises it. Gaps (e.g.
<code>VideoProcessor</code> interface has no impl yet) are listed
honestly rather than pretended-covered.</li>
</ol>
<h2 id="reproducing-the-evidence">Reproducing the evidence</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> dependencies/HelixDevelopment/VisionEngine</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> test <span class="at">-race</span> <span class="at">-count</span><span class="op">=</span>1 ./...</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> build ./...</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./challenges/scripts/visionengine_describe_challenge.sh</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./challenges/scripts/visionengine_describe_challenge.sh</span> <span class="at">--mutate</span></span></code></pre></div>
<p>Captured exit codes + last-line evidence MUST be pasted in the PR or
commit body that closes any work touching this module, per Article XI
§11.9. See <code>docs/test-coverage.md</code> for the round-297
reference capture.</p>
<h2 id="governance-cascade">Governance cascade</h2>
<p>This submodule inherits the universal Constitution from
<code>constitution/</code> at the meta-repo root and tightens it where
the submodule's scope is narrower. Project-specific clauses MUST never
appear in this submodule's source per CONST-051(B); they live in the
consuming project (HelixCode, HelixQA).</p>
<p>Relevant constitutional anchors:</p>
<ul>
<li><strong>CONST-035</strong> — Zero-bluff mandate (Article XI §11.9
forensic anchor)</li>
<li><strong>CONST-046</strong> — No hardcoded user-facing content
(Translator seam)</li>
<li><strong>CONST-050(A)</strong> — No fakes beyond unit tests</li>
<li><strong>CONST-051(B)</strong> — Decoupling / reusability
mandate</li>
<li><strong>CONST-053</strong> — <code>.gitignore</code> + no versioned
build artefacts</li>
<li><strong>CONST-054</strong> — Submodule-dependency manifest (see
<code>helix-deps.yaml</code> when present at root)</li>
<li><strong>CONST-060</strong> — Fetch-before-edit (first git action
every session)</li>
</ul>
<h2 id="license">License</h2>
<p>Apache License 2.0. See <code>LICENSE</code>.</p>
</body>
</html>