close
Skip to content

refactor(web-ui): route business invokes through adapter layer and dr… - #2428

Open
zvzuola wants to merge 1 commit into
GCWing:mainfrom
zvzuola:chore/remove-dead-agent-service
Open

refactor(web-ui): route business invokes through adapter layer and dr…#2428
zvzuola wants to merge 1 commit into
GCWing:mainfrom
zvzuola:chore/remove-dead-agent-service

Conversation

@zvzuola

@zvzuola zvzuola commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Route Web UI business-layer Tauri commands through the shared ApiClient adapter layer and remove the unused legacy AgentService.

This keeps platform invocation behind the frontend adapter boundary and allows the existing transport routing, including peer-device scenarios, to remain centralized.

Type and Areas

Type: Refactor / architecture boundary / cleanup

Areas: Web UI, frontend API adapters, Peer Device Mode integration

Motivation / Impact

Several Web UI business modules imported invoke directly from @tauri-apps/api/core. This bypassed the shared ApiClient routing layer and made it possible for new business code to bypass transport-aware behavior.

This PR:

  • Adds an ESLint no-restricted-imports rule that blocks direct invoke imports from @tauri-apps/api/core in business code.
  • Allows direct platform invocation only inside src/infrastructure/api/adapters/** and the intentional PeerHostInvokeBridge exception.
  • Routes the following modules through api.invoke:
    • Insights API
    • I18n API
    • Agent companion pet service
    • Announcement service
    • File context validation
    • Image context validation
    • IDE control event bus
  • Preserves the existing command names and request payloads while changing only the invocation path.
  • Removes the unused src/web-ui/src/shared/services/agent-service.ts legacy wrapper.
  • Removes the obsolete AgentService field, initialization, and getAvailableAgents() method from FlowChatManager.
  • Removes the corresponding obsolete test mock.

There is no intended direct user-facing behavior change. The main impact is improved architectural enforcement and consistent routing through the adapter layer.

Verification

GitHub checks for head commit 433f601122f6fac24630e1c6d5e9df7af213c3b5:

  • Rust / CLI Validation — passed.
  • Rust / CLI Impact — passed.
  • Shell Deploy Scripts — passed.
  • DSH Profile Packaging (windows-latest) — passed.
  • Frontend Build — in progress at the time this description was prepared.
  • Rust Build Check — skipped because this PR does not modify Rust sources.
  • CLI Tests — skipped because this PR does not modify CLI behavior.

The changed frontend tests and the new ESLint boundary rule should be covered by the frontend validation workflow.

Reviewer Notes

  • This PR intentionally does not move the peer-device host bridge behind ApiClient. PeerHostInvokeBridge executes dynamic commands on the host side of Peer Device Mode and remains the documented exception.
  • The deleted AgentService had no remaining consumers. Active agent and tool operations are already exposed through the existing service APIs and FlowChatManager.
  • The API command names and payload shapes are unchanged.
  • This is a frontend-only change; no Rust, backend, locale, or user-facing copy changes are included.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above.
  • User-facing strings, docs, and locales are updated where applicable.

…op dead AgentService

- Add eslint no-restricted-imports fence: business code must reach the
  platform only via api.invoke (ApiClient); direct invoke from
  '@tauri-apps/api/core' is reserved for adapters/** and the intentional
  PeerHostInvokeBridge exception.
- Reroute 8 A-class modules (insights, i18n, companion pet, announcement,
  file/image context, ide-control event bus) from direct invoke to api.invoke.
- Delete the dead legacy agent-service.ts wrapper (no consumers) and its
  FlowChatManager field/import/initialization, the orphaned getAvailableAgents()
  method, and its test mock.

Co-Authored-By: Claude <noreply@anthropic.com>
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