Skip to content

1.3.0 - #80

Merged
keyang556 merged 3 commits into
mainfrom
claude/nvda-addon-improvements-c417bb
Jul 23, 2026
Merged

1.3.0#80
keyang556 merged 3 commits into
mainfrom
claude/nvda-addon-improvements-c417bb

Conversation

@keyang556

@keyang556 keyang556 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

…build tooling

Global-plugin call gestures (NVDA+Windows+A/D/S/F) were running blocking OCR and time.sleep on NVDA's main thread instead of the app module's worker-thread wrappers, defeating the beta7 fix; they now delegate properly. Also fixes a cursor-restore gap in _sendMouseClick, an OCR-buffer leak on LINE exit, and a busy-poll file-dialog watcher.

Replaces private-API usage (_gestureMap mutation, direct braille buffer poking) with public NVDA APIs, unifies script categories, adds translatable descriptions to previously undecorated gestures, and adds speakOnDemand to pure-reporting scripts. Raises minimumNVDAVersion to 2024.1.

Adds a one-time consent dialog before AI image description uploads a screenshot using the bundled shared API key; users with their own key are never asked.

Syncs build tooling with the current NVDA AddonTemplate: speechDictionaries support, PEP 735 dependency groups, prek (replacing pre-commit), lint+test CI gates, tag-based prerelease detection, and removal of redundant one-off build scripts and stale committed artifacts.

Greptile Summary

此次更新完成先前意見的修正:

  • AI 圖片描述同意狀態改為依供應商分別記錄,寫入失敗時仍於目前工作階段保留同意。
  • 檔案對話方塊監看改為等待「出現後關閉」,並以權杖避免舊監看器跨越 AppModule 生命週期。
  • 同步建置工具、測試流程、翻譯資源與 NVDA 公開 API 用法。

Confidence Score: 5/5

此 PR 看起來可以安全合併。

先前提出的問題均已獲得完整修正。未發現仍存在的阻擋性失敗。

T-Rex T-Rex Logs

What T-Rex did

  • Before the change, the baseline revision d8fdccf produced 9 test failures in tests/test_ai_consent.py, exiting with code 1.
  • After the change, running uv run pytest -vv tests/test_ai_consent.py exited with code 0 and all 9 tests passed.
  • No changed-code-anchored failure was found during validation of the focused tests.
  • Artifacts were collected to document both the baseline and post-change test runs and the validation summary.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
addon/appModules/line.py AI 同意與檔案對話方塊生命週期修正完整涵蓋先前提出的失敗情境,未發現仍需個別處理的阻擋問題。
addon/appModules/_utils.py 新增逾期 OCR 資源清理,並改用公開點字訊息 API。
addon/globalPlugins/lineDesktopHelper.py 全域手勢改由 AppModule 的工作執行緒包裝腳本處理。
.github/workflows/build.yaml 建置流程新增程式碼檢查、單元測試及標籤式發行。
pyproject.toml 開發與建置相依套件改採 PEP 735 群組管理。
tests/test_ai_consent.py 涵蓋依供應商記錄、工作階段備援及持久化同意行為。
tests/test_line_resource_guards.py 驗證檔案對話方塊監看與終止時權杖失效機制。

Reviews (3): Last reviewed commit: "Make AI consent per-provider, always ask..." | Re-trigger Greptile

…build tooling

Global-plugin call gestures (NVDA+Windows+A/D/S/F) were running blocking OCR
and time.sleep on NVDA's main thread instead of the app module's worker-thread
wrappers, defeating the beta7 fix; they now delegate properly. Also fixes a
cursor-restore gap in _sendMouseClick, an OCR-buffer leak on LINE exit, and a
busy-poll file-dialog watcher.

Replaces private-API usage (_gestureMap mutation, direct braille buffer
poking) with public NVDA APIs, unifies script categories, adds translatable
descriptions to previously undecorated gestures, and adds speakOnDemand to
pure-reporting scripts. Raises minimumNVDAVersion to 2024.1.

Adds a one-time consent dialog before AI image description uploads a
screenshot using the bundled shared API key; users with their own key are
never asked.

Syncs build tooling with the current NVDA AddonTemplate: speechDictionaries
support, PEP 735 dependency groups, prek (replacing pre-commit), lint+test
CI gates, tag-based prerelease detection, and removal of redundant one-off
build scripts and stale committed artifacts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread addon/appModules/line.py Outdated
Comment thread addon/appModules/line.py Outdated
…eImage crash

_hasAiConsent/_recordAiConsent: a failed disk write after the user chose Yes
left every subsequent call still refusing with "not consented"; add an
in-memory session fallback so a grant stays honored for the rest of the
NVDA session regardless of disk state.

_suppressAddonForFileDialog: replace the two-phase appear-then-disappear
wait with a single poll that requires observing the dialog open before
declaring it closed, fixing a race where a file dialog slower than 2s to
appear caused the addon to resume key interception while the dialog was
still opening.

script_describeImage: defer the consent dialog (and the rest of the flow)
via wx.CallAfter instead of calling it synchronously from the script, which
crashed on the first NVDA+Windows+I use. Scripts run on the keyboard hook's
call stack; every dialog-opening script in NVDA's own globalCommands.py
defers the same way.

Also includes the excludedFiles fix from the prior build (excludes
__pycache__ from the packaged addon) and its regenerated locale manifests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread addon/appModules/line.py Outdated
Comment thread addon/appModules/line.py
…watchers

Consent for one cloud AI provider no longer implies consent for another:
_hasAiConsent/_recordAiConsent are now scoped per provider (stored as one
provider ID per line instead of a single "1" marker), and the worker
chokepoint checks consent against the provider it is actually about to
call, so switching provider mid-conversation can't inherit a prior
provider's consent.

Consent is now asked on first use of each provider regardless of whether
the request uses the add-on's bundled key or the user's own: owning a key
doesn't answer which company receives the screenshot. Removed the
now-unused _isImageDescriptionUsingUserKey and updated the dialog wording,
readmes, and changelog in all four languages to match.

_suppressAddonForFileDialog's watcher now bails out as soon as its watch
token is invalidated, and terminate() invalidates it; previously an
orphaned watcher (LINE closed/restarted before the dialog was first seen)
could poll a recycled PID for up to 30 minutes into the next LINE session.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@keyang556
keyang556 merged commit 54c6cf1 into main Jul 23, 2026
3 checks passed
@keyang556
keyang556 deleted the claude/nvda-addon-improvements-c417bb branch July 25, 2026 03:34
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