• Will Chen's avatar
    IPC Contracts (#2276) · 5d2e87fc
    Will Chen 提交于
    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > Modernizes IPC usage app-wide to new typed, namespaced contracts.
    > 
    > - Refactors calls from `IpcClient` to `ipc.*` namespaces (system, app,
    chat, github, git, version, languageModel, neon, visualEditing, context,
    misc, capacitor, template, events, upgrade, agent, proposal)
    > - Updates type imports from `"@/ipc/ipc_types"` to `"@/ipc/types"`
    (e.g., `ListedApp`, security types) and adapts optional fields
    > - Aligns method signatures to object params and new return shapes
    (e.g., `getAppVersion` → `{ version }`); replaces various URL
    opens/restarts/screenshots with `ipc.system.*`
    > - Moves custom theme and theme generation ops to `ipc.template.*`;
    adds maxOutputTokens in custom model dialogs; adjusts provider/model
    management APIs
    > - Switches GitHub/Vercel/Neon/Supabase/Capacitor connectors and
    branching flows to new IPC endpoints; updates event subscriptions for
    GitHub device flow
    > - Normalizes logging/preview interactions and visual editing
    apply/analyze via `ipc.misc`/`ipc.visualEditing`
    > 
    > Potential follow-ups: verify all parameter objects and event handlers,
    and update any remaining legacy imports.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    7c574fe53296ba5c9a16d6b69d1008d06490534e. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Adopted the new typed IPC contracts across the app, replacing IpcClient
    with namespaced ipc methods. Restored app output streaming via events,
    added maxOutputTokens for custom model flows, migrated custom theme
    operations to ipc.template, and fixed chat stream cancellation
    lifecycle.
    
    - **Refactors**
    - Replaced IpcClient usage with ipc.* namespaces (system, app, chat,
    github, git, version, languageModel, neon, visualEditing, context,
    prompt, mcp, misc, capacitor, template, events, upgrade, agent,
    proposal).
    - Moved type imports from "@/ipc/ipc_types" to "@/ipc/types"; adjusted
    renamed types and paths (e.g., ListedApp under "@/ipc/types/app",
    security types under "@/ipc/types/security").
    - Updated method signatures to use object params and new return shapes
    (e.g., getAppVersion returns { version }).
    - Subscribed to ipc.events.misc.onAppOutput in useRunApp to process app
    output, restore preview URL updates, and handle HMR after API changes.
    - Added missing maxOutputTokens in create/edit custom model dialogs;
    small UI and hooks changes to align with new contracts.
    - Fixed DeepLinkData typing by re-exporting a discriminated union for
    correct type narrowing.
    - Migrated custom themes and theme generation to ipc.template.*; added
    CustomTheme and theme generation types.
    - Moved methods to correct namespaces (e.g., takeScreenshot/restartDyad
    → system; checkProblems → misc).
    - Emit chat:stream:end on stream cancellation for consistent renderer
    cleanup.
    
    - **Migration**
      - Replace any remaining IpcClient references with ipc.*.
    - Update type imports to "@/ipc/types" and adjust for changed/optional
    fields (e.g., App lists use ListedApp; Collaborator.permissions and
    VercelProject.framework may be optional).
    - Verify callers for new parameter objects and result shapes; replace
    runApp/restartApp callbacks with ipc.events.misc.onAppOutput
    subscriptions.
    
    <sup>Written for commit 7c574fe53296ba5c9a16d6b69d1008d06490534e.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2276">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    ---------
    Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
    5d2e87fc
window_handlers.ts 1.3 KB