Skip to content

[codex] Extract provider model controls#453

Merged
elkimek merged 1 commit into
mainfrom
codex/extract-provider-model-controls
May 30, 2026
Merged

[codex] Extract provider model controls#453
elkimek merged 1 commit into
mainfrom
codex/extract-provider-model-controls

Conversation

@elkimek
Copy link
Copy Markdown
Owner

@elkimek elkimek commented May 30, 2026

Summary

  • Move provider model dropdown and pricing handlers into provider-model-controls.js.
  • Keep provider-panels.js focused on provider key, balance, wallet, and local model advisor flows while re-exporting existing window-facing helpers.
  • Add the new module to the service worker app shell and bump the app version to 1.8.279.

Validation

  • node tests/test-openrouter.js
  • node tests/test-custom-api.js
  • node tests/test-venice-e2ee.js
  • node tests/test-audit.js
  • node tests/test-cashu-wallet.js
  • ./run-tests.sh

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
get-based Ready Ready Preview, Comment May 30, 2026 1:18pm

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR extracts the provider model dropdown and pricing handler functions from provider-panels.js into a new provider-model-controls.js module, keeping provider-panels.js focused on key management, balance, wallet, and local model advisor flows.

  • All moved functions are re-exported from provider-panels.js via explicit export {...} from './provider-model-controls.js' blocks, and the existing Object.assign(window, {...}) block still covers every function needed for inline HTML onclick/onchange handlers, so no regression in window-facing behavior.
  • The new module is correctly added to the service worker APP_SHELL before provider-panels.js, and the version is bumped to 1.8.279 to bust the cache.
  • Test files across four test suites are updated to look for the moved functions in provider-model-controls.js rather than provider-panels.js.

Confidence Score: 4/5

Safe to merge — this is a straightforward code extraction with no behavioral changes.

The refactor cleanly moves model dropdown and pricing functions to a dedicated module. All window-facing function registrations remain intact in provider-panels.js's Object.assign block, re-exported functions behave identically to the originals, and the new module is correctly added to the service worker cache with a version bump. The one minor deviation from the CLAUDE.md convention is that provider-model-controls.js does not carry its own Object.assign(window, ...) block — window exposure is delegated entirely to provider-panels.js, which works correctly here but is a slight inconsistency with how other modules in this codebase self-register their window-facing handlers.

js/provider-model-controls.js — new file worth a quick scan to confirm no window registration is needed independently if provider-panels.js ever stops acting as the re-export barrel.

Important Files Changed

Filename Overview
js/provider-model-controls.js New module extracting all provider model dropdown render functions, pricing updaters, and model change handlers; no window registration block in the module itself — relies on provider-panels.js's Object.assign for window exposure.
js/provider-panels.js Removes model dropdown/pricing function bodies, imports them from provider-model-controls.js, re-exports them via named export blocks, and retains all window assignments; getVeniceE2EE remains correctly imported and used.
service-worker.js Adds /js/provider-model-controls.js to APP_SHELL before provider-panels.js; ordering is correct given the dependency direction.
tests/test-audit.js Adds one assertion verifying provider-model-controls.js is in the service worker shell; straightforward update.
tests/test-openrouter.js Updates source-inspection assertions to check renderOpenRouterModelDropdown and updateOpenRouterModelPricing in providerModelControlsSrc instead of ppSrc; also verifies new SW cache entry.
tests/test-venice-e2ee.js Redirects toggleVeniceE2EE and onVeniceModelDropdownChange checks to providerModelControlsSrc; combined source string updated for the onchange handler assertion.
tests/test-custom-api.js Updates function-presence and import assertions to point at providerModelControlsSrc for setCustomApiModel, renderCustomApiModelDropdown, and applyCustomApiManualModel.
version.js Bumps APP_VERSION from 1.8.278 to 1.8.279 to invalidate the service worker cache after the new module is added to APP_SHELL.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[provider-panels.js] -->|imports & re-exports| B[provider-model-controls.js]
    B -->|imports| C[api.js\nget/setVeniceModel\nget/setOpenRouterModel\nget/setRoutstrModel\nget/setPpqModel\nget/setCustomApiModel\nrenderModelPricingHint\nfetchOpenRouterModelPricing\ngetVeniceE2EE / setVeniceE2EE]
    B -->|imports| D[provider-panel-renderers.js\nbuildModelOptions]
    B -->|imports| E[utils.js\nescapeHTML\nshowNotification]
    A -->|Object.assign window| F[window\nonVeniceModelDropdownChange\ntoggleVeniceE2EE\nupdateVeniceModelPricing\nonOpenRouterDropdownChange\napplyCustomOpenRouterModel\nupdateOpenRouterModelPricing\nupdateRoutstrModelPricing\nupdatePpqModelPricing\nupdateCustomModelPricing\napplyCustomApiManualModel\nrenderCustomApiModelDropdown\n...]
    G[service-worker.js\nAPP_SHELL] -->|caches| B
    G -->|caches| A
    H[HTML inline handlers\nonchange / onkeydown] -->|calls via window| F
Loading

Reviews (1): Last reviewed commit: "Extract provider model controls" | Re-trigger Greptile

@elkimek elkimek merged commit d2e2a07 into main May 30, 2026
5 checks passed
@elkimek elkimek deleted the codex/extract-provider-model-controls branch May 30, 2026 13:26
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