Skip to content

feat(plugins): move OCR management to Plugins Hub - #2067

Merged
yyhhyyyyyy merged 6 commits into
devfrom
feat/ocr-plugin-hub
Jul 30, 2026
Merged

feat(plugins): move OCR management to Plugins Hub#2067
yyhhyyyyyy merged 6 commits into
devfrom
feat/ocr-plugin-hub

Conversation

@yyhhyyyyyy

@yyhhyyyyyy yyhhyyyyyy commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Move OCR management from the Settings sidebar into the Plugins Hub as a built-in capability alongside CUA.

OCR remains owned by its existing runtime and settings modules. It is not converted into a .dcplugin.

Before / After

BEFORE

Settings
└─ Tools
   └─ OCR

Plugins Hub
├─ CUA
└─ Official / Remote plugins


AFTER

Settings
└─ OCR hidden
   └─ Legacy /ocr route retained

Plugins Hub
├─ OCR (built-in, fixed first)
├─ CUA
└─ Official / Remote plugins

Changes

  • Add the /plugins/builtin/ocr management route.
  • Reuse the existing OcrSettings component without duplicating or extracting its UI.
  • Add a fixed-first OCR catalog card with:
    • Built-in capability badge
    • Available or unavailable runtime status
    • Actionable unavailable reasons
    • Management access when status loading fails
  • Hide settings-ocr from the Settings sidebar while retaining the route and component.
  • Preserve the existing OCR Spotlight keywords.
  • Route OCR Spotlight searches to the Plugins Hub.
  • When an ACP agent is selected, open the retained settings-ocr compatibility route instead of navigating into the ACP-gated Plugins Hub.
  • Cache OCR catalog status in pluginCatalogStore with latest-request-wins protection.
  • Display refresh failures as unknown status instead of retaining a stale Available badge.
  • Pause OCR polling while the renderer is hidden or unfocused, and refresh when it becomes active again.
  • Align the OCR back button with the settings content container.
  • Remove the obsolete hard-coded Light OCR 0.3.4 version from all locale messages.
  • Regenerate src/types/i18n.d.ts.
  • Update the maintained OCR and Plugins Hub specifications.

Compatibility

The legacy settings-ocr route remains registered because persisted settings activity records and direct links depend on it.

It continues to render the same management component as a compatibility surface, but the Plugins Hub is now the canonical entry.

Both surfaces may coexist in separate windows. Visibility and focus gating prevent inactive instances from continuing background status polling.

No OCR runtime, IPC, cache format, persisted setting, or attachment-routing behavior was changed.

Summary by CodeRabbit

  • New Features
    • Added built-in OCR to the Plugins Hub with a dedicated management page.
    • Added a Spotlight action to open OCR, with special routing when an ACP agent is selected.
    • Enhanced the composer with vision-model switching and improved representation controls based on OCR/vision availability.
  • Bug Fixes
    • Prevented stale OCR “Available” badges when refresh fails; failures now show an unknown/diagnostic state, and only the proper UI surfaces indicate staleness.
    • OCR runtime polling now runs only while the app is visible and focused.
  • Localization
    • Updated OCR unsupported-platform messaging and added “built-in capability” labels across supported languages.

@dosubot

dosubot Bot commented Jul 30, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-08-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about deepchat Add Dosu to your team

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c250ecd8-8a50-4dc2-a76d-162fc0ea986b

📥 Commits

Reviewing files that changed from the base of the PR and between e974fe4 and 32c7c84.

⛔ Files ignored due to path filters (2)
  • src/renderer/src/lib/icons/icon-collections.generated.ts is excluded by !**/*.generated.*
  • src/renderer/src/lib/icons/icon-whitelist.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (1)
  • test/renderer/stores/spotlight.test.ts

📝 Walkthrough

Walkthrough

Light OCR is integrated into the Plugins Hub and composer with dedicated routing, shared runtime status, focus-aware polling, progressive attachment controls, localized labels, and expanded tests.

Changes

Light OCR Plugins Hub and composer integration

Layer / File(s) Summary
OCR routing and page surface
docs/features/plugins-hub/spec.md, docs/features/light-ocr-integration/spec.md, src/renderer/src/stores/ui/spotlight.ts, src/renderer/src/router/index.ts, src/renderer/src/pages/plugins/OcrPluginsPage.vue, src/shared/settingsNavigation.ts, test/renderer/...
Spotlight opens the built-in OCR route normally and retains settings-ocr for ACP agents; the new page renders OcrSettings.
Built-in OCR catalog and shared status
src/renderer/src/pages/plugins/PluginsCatalogPage.vue, src/renderer/src/stores/pluginCatalog.ts, test/renderer/components/PluginsCatalogPage.test.ts, test/renderer/stores/pluginCatalogStore.test.ts, docs/features/plugins-hub/spec.md
The catalog adds built-in OCR, shares runtime status, routes its action, and suppresses stale availability after failed refreshes.
Visibility and focus-aware polling
src/renderer/settings/components/OcrSettings.vue, test/renderer/components/OcrSettings.test.ts
Polling pauses when hidden or unfocused, resumes when both conditions return, and refreshes immediately.
Progressive attachment representation controls
src/renderer/src/components/chat/..., src/renderer/src/features/chat-page/..., src/renderer/src/pages/NewThreadPage.vue, test/renderer/components/..., docs/features/light-ocr-integration/*
Composer context exposes vision and OCR state; attachment controls gate unavailable choices, preserve explicit preferences, hide ACP no-op controls, and open the vision-model picker when required.
Localized OCR and catalog labels
src/types/i18n.d.ts, src/renderer/src/i18n/*/settings.json
Locale schemas and translations add pluginsHub.builtinCapability and replace version-specific unsupported-platform OCR messages.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested reviewers: zerob13

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: moving OCR management into the Plugins Hub.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ocr-plugin-hub

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/renderer/stores/spotlight.test.ts (1)

8-11: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the agentType ACP compatibility branch.

The production condition uses selectedAgent.agentType ?? selectedAgent.type, but the new test only exercises the fallback type: 'acp' path. Add a focused case with { type: 'deepchat', agentType: 'acp' } to verify the precedence used by the compatibility route.

As per coding guidelines, add the smallest regression test for user-visible behavior or a documented contract.

Also applies to: 255-295

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/renderer/stores/spotlight.test.ts` around lines 8 - 11, Extend the
selected-agent test coverage with a focused case using { type: 'deepchat',
agentType: 'acp' } to exercise the compatibility route’s agentType precedence.
Keep the existing fallback type: 'acp' case and assert the same user-visible ACP
behavior for this override scenario.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/renderer/stores/spotlight.test.ts`:
- Around line 8-11: Extend the selected-agent test coverage with a focused case
using { type: 'deepchat', agentType: 'acp' } to exercise the compatibility
route’s agentType precedence. Keep the existing fallback type: 'acp' case and
assert the same user-visible ACP behavior for this override scenario.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d0baf395-fc9c-4a46-8385-be2ae6fc621e

📥 Commits

Reviewing files that changed from the base of the PR and between 85d9a79 and df8757b.

📒 Files selected for processing (37)
  • docs/features/light-ocr-integration/spec.md
  • docs/features/plugins-hub/spec.md
  • src/renderer/settings/components/OcrSettings.vue
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/de-DE/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/es-ES/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/id-ID/settings.json
  • src/renderer/src/i18n/it-IT/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/ms-MY/settings.json
  • src/renderer/src/i18n/pl-PL/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/tr-TR/settings.json
  • src/renderer/src/i18n/vi-VN/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/pages/plugins/OcrPluginsPage.vue
  • src/renderer/src/pages/plugins/PluginsCatalogPage.vue
  • src/renderer/src/router/index.ts
  • src/renderer/src/stores/pluginCatalog.ts
  • src/renderer/src/stores/ui/spotlight.ts
  • src/shared/settingsNavigation.ts
  • src/types/i18n.d.ts
  • test/main/shared/settingsNavigation.test.ts
  • test/renderer/components/OcrSettings.test.ts
  • test/renderer/components/PluginPageWrappers.test.ts
  • test/renderer/components/PluginsCatalogPage.test.ts
  • test/renderer/router/pluginsRouter.test.ts
  • test/renderer/stores/pluginCatalogStore.test.ts
  • test/renderer/stores/spotlight.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/renderer/src/components/chat/nodes/FileAttachmentView.vue`:
- Around line 231-237: Replace the stylesheet-based coarse-pointer override in
FileAttachmentView’s attachment-representation-trigger with a VueUse
media-query-driven class binding for (pointer: coarse), ensuring the trigger
remains visible on touch devices regardless of Tailwind stylesheet ordering;
remove the conflicting scoped CSS rule and preserve the existing hover behavior
for non-coarse pointers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b86b4e9-1e67-400c-8016-6c70c87be89b

📥 Commits

Reviewing files that changed from the base of the PR and between df8757b and e974fe4.

📒 Files selected for processing (16)
  • docs/features/light-ocr-integration/plan.md
  • docs/features/light-ocr-integration/spec.md
  • docs/features/light-ocr-integration/tasks.md
  • docs/features/plugins-hub/spec.md
  • src/renderer/src/components/chat/ChatInputBox.vue
  • src/renderer/src/components/chat/attachmentModelPicker.ts
  • src/renderer/src/components/chat/nodes/FileAttachmentView.vue
  • src/renderer/src/components/chat/nodes/symbols.ts
  • src/renderer/src/features/chat-page/ChatPage.vue
  • src/renderer/src/features/chat-page/composables/useComposerSubmit.ts
  • src/renderer/src/pages/NewThreadPage.vue
  • test/renderer/components/ChatInputBox.test.ts
  • test/renderer/components/ChatPage.test.ts
  • test/renderer/components/FileAttachmentView.test.ts
  • test/renderer/components/NewThreadPage.test.ts
  • test/renderer/features/chat-page/composables/useComposerSubmit.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/features/plugins-hub/spec.md
  • docs/features/light-ocr-integration/spec.md

Comment on lines +231 to +237
<style scoped>
@media (pointer: coarse) {
.attachment-representation-trigger {
opacity: 1;
}
}
</style>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Coarse-pointer override depends on stylesheet ordering.

.attachment-representation-trigger { opacity: 1 } and Tailwind's .opacity-0 (line 19) have equal specificity, so visibility on touch devices is decided by injection order. Consider driving the class binding instead (e.g. VueUse useMediaQuery('(pointer: coarse)')) so the trigger is reliably visible without hover.

As per coding guidelines, src/renderer/** should "prefer existing shadcn-vue primitives and VueUse utilities".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/src/components/chat/nodes/FileAttachmentView.vue` around lines
231 - 237, Replace the stylesheet-based coarse-pointer override in
FileAttachmentView’s attachment-representation-trigger with a VueUse
media-query-driven class binding for (pointer: coarse), ensuring the trigger
remains visible on touch devices regardless of Tailwind stylesheet ordering;
remove the conflicting scoped CSS rule and preserve the existing hover behavior
for non-coarse pointers.

Source: Coding guidelines

@yyhhyyyyyy
yyhhyyyyyy merged commit b32b4d4 into dev Jul 30, 2026
12 checks passed
@zhangmo8
zhangmo8 deleted the feat/ocr-plugin-hub branch July 31, 2026 10:22
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