Skip to content

feat(vision): add optional OmniParser HTTP provider (#1053)#1107

Open
shaun0927 wants to merge 2 commits into
feat/1052-perception-snapshotfrom
feat/1053-omniparser-http
Open

feat(vision): add optional OmniParser HTTP provider (#1053)#1107
shaun0927 wants to merge 2 commits into
feat/1052-perception-snapshotfrom
feat/1053-omniparser-http

Conversation

@shaun0927
Copy link
Copy Markdown
Owner

Summary

Implements #1053 as a stacked follow-up on #1093 / #1052:

  • adds OmniParserHttpProvider, an optional HTTP adapter for an already-running OmniParser-compatible service
  • keeps the default provider as DOM; OmniParser is used only when OPENCHROME_VISION_PROVIDER=omniparser-http and snapshot output is requested
  • supports OPENCHROME_OMNIPARSER_URL, OPENCHROME_OMNIPARSER_TIMEOUT_MS, and OPENCHROME_OMNIPARSER_MAX_ELEMENTS
  • converts parsed_content_list ratio/pixel bboxes into PerceptionSnapshot elements
  • bounds labels/elements, redacts password-like labels via the shared snapshot sanitizer, and emits warnings for malformed/truncated entries
  • falls back to DOM snapshot with explicit warnings when the external provider is missing, malformed, unavailable, or times out

Stack / duplicate check

Verification

Passed:

  • npm test -- --runInBand tests/vision/omniparser-http-provider.test.ts
  • npm test -- --runInBand tests/vision/perception-snapshot.test.ts tests/vision/omniparser-http-provider.test.ts
  • npm run build
  • npm run lint:tier
  • npm run lint:changed
  • git diff --check

Baseline notes:

  • npm run lint still fails on unrelated existing errors:
    • src/session-manager.ts:959:7 no-useless-catch
    • src/tools/connect.ts:43:69 @typescript-eslint/ban-types
  • Full npm test was not rerun here because the preceding feat(vision): add provider-neutral perception snapshots (#1052) #1093 worktree already exposed unrelated existing failures in tests/tools/tabs.test.ts.

Merge validation path via OpenChrome

After #1093 lands, validate this PR with an OmniParser-compatible mock service:

  1. Start OpenChrome with:
    • OPENCHROME_VISION_PROVIDER=omniparser-http
    • OPENCHROME_OMNIPARSER_URL=http://127.0.0.1:<mock-port>/parse/
  2. Call vision_find with { "format": "snapshot", "includeImage": false }.
  3. Confirm returned snapshot has provider: "omniparser-http", source: "omniparser-http" elements, bounded labels, and normalized bboxRatio.
  4. Switch the mock to timeout/malformed mode and repeat.
  5. Confirm the tool returns a DOM fallback snapshot with a warning instead of failing the MCP call.
  6. Restart OpenChrome without env vars and confirm omniparser-http does not appear in default snapshot output.

Closes #1053.

Constraint: OmniParser must remain an external, explicitly configured HTTP service so core OpenChrome stays dependency-light.

Rejected: Add Python/Torch/Docker or make OmniParser the default provider | violates the adapter-only issue boundary and would risk harness stability.

Confidence: high

Scope-risk: moderate

Directive: Keep external visual providers timeout-bounded, warning-backed, and safe to fall back to DOM snapshots.

Tested: npm test -- --runInBand tests/vision/omniparser-http-provider.test.ts; npm test -- --runInBand tests/vision/perception-snapshot.test.ts tests/vision/omniparser-http-provider.test.ts; npm run build; npm run lint:tier; npm run lint:changed; git diff --check

Not-tested: Full npm test not rerun because the preceding PR branch already exposed unrelated tests/tools/tabs.test.ts failures; npm run lint still has unrelated baseline errors in src/session-manager.ts and src/tools/connect.ts; live OpenChrome MCP mock-server verification not run in this worktree.
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Resolve the stacked vision_find conflict so the optional OmniParser HTTP snapshot provider coexists with occlusion, iframe, and tiled DOM capture options inherited from the perception snapshot base.

Constraint: PR #1107 targets the perception-snapshot branch after that branch learned richer DOM capture options.
Rejected: Dropping tiled/iframe options or the OmniParser provider | both are opt-in surfaces and do not need to conflict.
Confidence: medium
Scope-risk: moderate
Directive: Keep OmniParser HTTP opt-in and preserve legacy DOM output as the default vision_find behavior.
Tested: npx jest tests/vision/omniparser-http-provider.test.ts tests/vision/vision-find.test.ts tests/vision/perception-snapshot.test.ts --runInBand --forceExit; npm ci; npm run build; git diff --check for touched file.
Not-tested: Full GitHub Actions matrix.
Co-authored-by: OmX <omx@oh-my-codex.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant