Skip to content

feat: provider update advisories with one-click updates#75

Merged
tyulyukov merged 1 commit intomainfrom
marcode/pr-provider-update-advisories
Apr 29, 2026
Merged

feat: provider update advisories with one-click updates#75
tyulyukov merged 1 commit intomainfrom
marcode/pr-provider-update-advisories

Conversation

@tyulyukov
Copy link
Copy Markdown
Owner

Summary

Ports t3code#2312 by @justsomelegs.

Wires version lifecycle + update state for managed providers (Claude, Codex, Cursor, OpenCode):

  • Each provider snapshot now carries `versionAdvisory` (latest npm version vs installed; computed via TTL-cached registry lookup) plus a transient `updateState` (`queued | running | succeeded | failed | unchanged`).
  • Server-side `providerUpdater` runs provider-specific update commands with concurrency control and broadcasts state transitions through the ProviderRegistry.
  • New `server.updateProvider` WS RPC, exposed via `LocalApi` / `WsRpcClient` / `wsNativeApi`.
  • Toast (`ProviderUpdateLaunchNotification`) prompts when an update is available and lets the user trigger it from the toast.
  • Sidebar pill (`SidebarProviderUpdatePill`) shows in-progress / final status with auto-dismiss for success and manual dismiss for failure.
  • Provider settings panel: per-provider advisory detail block with a copy-command button, an Update button + spinner, and a deep-link from update entry points (`/settings/general#providers`) that smooth-scrolls to Providers.

What changed (server)

File Change
`provider/Layers/{Claude,Codex,Cursor,OpenCode}Provider.ts` New version-advisory wiring per provider
`provider/Layers/ProviderRegistry.ts` Tracks transient `updateState` per provider; excludes it from on-disk status cache
`provider/Services/{ProviderRegistry,ServerProvider}.ts` New service shape for updateState + setProviderUpdateState
`provider/providerUpdater.ts` (new) Concurrency-controlled updater with state-transition pubsub
`provider/providerVersionLifecycle.ts` (new) npm-registry latest-version lookup with TTL cache + `canUpdate` rules
`server.test.ts`, `ws.ts` New `server.updateProvider` RPC wired into ws server

What changed (web)

File Change
`components/ProviderUpdateLaunchNotification.tsx` (new) Per-provider toast prompts; one-click update + terminal toasts
`components/sidebar/SidebarProviderUpdatePill.tsx` (new) Active update progress / most-recent terminal outcome pill
`components/Sidebar.tsx` Mounts the pill in the sidebar footer
`components/settings/SettingsPanels.tsx` Per-provider advisory + Update button; `initialScrollTarget="providers"` smooth-scrolls
`components/settings/settingsLayout.tsx` Plumbs `initialScrollTarget` through
`routes/settings.general.tsx` Reads `#providers` hash and forwards
`routes/__root.tsx` Mounts ``
`localApi.ts` / `wsNativeApi.ts` / `rpc/wsRpcClient.ts` `updateProvider` shim through to the ws RPC
`components/ui/toast.tsx`, `index.css` Toast variants used by the launch notification

What changed (contracts)

File Change
`packages/contracts/src/server.ts` `ServerProviderUpdateState`, `ServerProviderVersionAdvisory`, `ServerProviderUpdatedPayload`, `ServerProviderUpdateError`
`packages/contracts/src/rpc.ts` `server.updateProvider` RPC schema
`packages/contracts/src/ipc.ts` Desktop bridge update for the new RPC

MarCode adjustments vs upstream

  • `@t3tools/contracts` → `@marcode/contracts` in `providerUpdater.ts`, `providerVersionLifecycle.ts`, `providerUpdater.test.ts`, and the new `ProviderUpdateLaunchNotification*` files.
  • `ws.ts` kept MarCode's existing `ProviderService` import (squash merge had treated it as either-or vs the new `makeProviderUpdater`; both are needed).
  • `SettingsPanels.tsx`: kept MarCode's `PROVIDER_DISPLAY_NAMES`-based display-name resolution (upstream switched to `liveProvider.displayName || formatProviderKindLabel`; out of scope for this PR), kept MarCode's `TurnNotificationSettingsSection` helpers (deleted by the squash merge), and made `initialScrollTarget` optional via `= {}` so existing `` calls still typecheck.
  • `wsNativeApi.ts`: added the new `server.updateProvider` to the native RPC bridge (MarCode-only file).

Test plan

  • `bun --cwd packages/contracts run typecheck` — clean
  • `bun --cwd apps/server run typecheck` — clean (only pre-existing Effect-style suggestion warnings remain)
  • `bun --cwd apps/web run typecheck` — clean
  • `bun --cwd apps/desktop run typecheck` — clean
  • `bun --cwd apps/server run test` — 1028 passing
  • `bun --cwd apps/web run test` — 1125 passing
  • Manual smoke (reviewer):
    • With an outdated provider installed, see the toast prompt → click Update → success toast / sidebar pill flips through queued → running → succeeded.
    • Open Settings → General → Providers via the toast's deep link; page smooth-scrolls to Providers.
    • Click "copy command" — terminal copy works.

Upstream

Original PR: pingdotgg#2312

Ports pingdotgg#2312 by @justsomelegs.

Wires version lifecycle + update state for managed providers (Claude,
Codex, Cursor, OpenCode):

- Each provider snapshot now carries `versionAdvisory` (latest npm
  version vs installed; computed via TTL-cached registry lookup) plus
  transient `updateState` (`queued | running | succeeded | failed |
  unchanged`).
- Server-side `providerUpdater` runs provider-specific update commands
  with concurrency control and broadcasts state transitions through the
  ProviderRegistry.
- New `server.updateProvider` WS RPC, exposed via LocalApi /
  WsRpcClient.
- Toast (`ProviderUpdateLaunchNotification`) prompts when an update is
  available and lets the user trigger it from the toast.
- Sidebar pill (`SidebarProviderUpdatePill`) shows in-progress / final
  status with auto-dismiss for success and manual dismiss for failure.
- Provider settings panel: per-provider advisory detail block with copy
  command, Update button + spinner, and a deep-link from update entry
  points (`/settings/general#providers`) that smooth-scrolls to
  Providers.

MarCode adjustments vs upstream:

- @t3tools/contracts → @marcode/contracts in providerUpdater.ts,
  providerVersionLifecycle.ts, providerUpdater.test.ts, and the new
  ProviderUpdateLaunchNotification* files.
- ws.ts kept MarCode's existing ProviderService import (squash-merge had
  treated it as either-or vs the new makeProviderUpdater); both are
  needed.
- SettingsPanels.tsx: kept MarCode's PROVIDER_DISPLAY_NAMES-based
  display name (upstream switched to liveProvider.displayName ||
  formatProviderKindLabel; out of scope for this PR), kept MarCode's
  TurnNotificationSettingsSection helpers (deleted by squash-merge),
  and made initialScrollTarget optional via `= {}` so existing
  `<GeneralSettingsPanel />` calls still typecheck.
- wsNativeApi.ts: added the new `server.updateProvider` to the native
  RPC bridge (MarCode-only file).
@tyulyukov tyulyukov merged commit 307d108 into main Apr 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant