Commit Graph

63 Commits

Author SHA1 Message Date
Kunthawat Greethong
99b0cdf8ac feat: implement custom smart context functionality with hooks, IPC handlers, and utilities
Some checks failed
CI / test (map[image:macos-latest name:macos], 1, 4) (push) Has been cancelled
CI / test (map[image:macos-latest name:macos], 2, 4) (push) Has been cancelled
CI / test (map[image:macos-latest name:macos], 3, 4) (push) Has been cancelled
CI / test (map[image:macos-latest name:macos], 4, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 1, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 2, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 3, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 4, 4) (push) Has been cancelled
CI / merge-reports (push) Has been cancelled
- Added custom hooks for managing smart context metadata and snippets.
- Implemented IPC handlers for retrieving context, upserting snippets, and updating summaries.
- Created utility functions for reading and writing smart context data to the filesystem.
- Established a structured custom code organization under src/custom/ for better maintainability.
- Included a comprehensive update guide to assist with future updates and custom feature integration.
2025-12-18 09:00:17 +07:00
Will Chen
213def4a67 Use user info proxy (#1963)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Switches budget fetch to `https://api.dyad.sh/v1/user/info` and
validates/consumes `usedCredits`, `totalCredits`, and `budgetResetDate`
directly via Zod.
> 
> - **IPC/Pro handlers (`src/ipc/handlers/pro_handlers.ts`)**:
> - **Endpoint**: Update user info URL to
`https://api.dyad.sh/v1/user/info`.
> - **Validation**: Add `zod` schema `UserInfoResponseSchema` to
validate API response.
> - **Data mapping**: Use `usedCredits`, `totalCredits`,
`budgetResetDate`, and `userId` from response directly; remove
conversion logic and old nested `user_info` parsing.
> - **Redaction**: Compute `redactedUserId` from `userId` and return
parsed `UserBudgetInfo`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
da1f192c2cabb2154bd10b69555c27d62fbb6368. 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
Switched user budget fetch to the new user info proxy and added schema
validation. Uses API-provided credits directly and removes the old
conversion logic.

- **Refactors**
  - Use https://api.dyad.sh/v1/user/info instead of llm-gateway.
- Validate response with a Zod schema (usedCredits, totalCredits,
budgetResetDate, userId).
  - Map fields directly to UserBudgetInfo and remove CONVERSION_RATIO.
  - Keep redacted user ID format (****1234).

- **Dependencies**
- Removed unused html-dom-parser, html-react-parser, and react-property
from the lockfile.

<sup>Written for commit da1f192c2cabb2154bd10b69555c27d62fbb6368.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-15 14:25:55 -08:00
Mohamed Aziz Mejri
a4ab1a7f84 Annotator (#1861)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds an in-app screenshot annotator to the Preview panel for Pro users
so you can capture the current app view, draw or add text, and submit an
annotated image to chat.

- **New Features**
- Pen button in PreviewIframe to toggle annotator; captures a screenshot
via worker messaging and displays it in a Konva canvas.
- Tools: select, freehand draw, and draggable text; supports undo/redo,
delete, and resizing with Transformer. Canvas scales to the container.
Includes a color picker.
- Submit exports a PNG and attaches it to the chat via useAttachments;
prefills the chat input; annotator auto-closes after submit.
  - Pro-only: non-Pro users see an upsell screen.
- State atoms added: annotatorModeAtom, screenshotDataUrlAtom,
attachmentsAtom; PreviewIframe now handles dyad-screenshot-response
messages.

- **Dependencies**
  - Added konva, react-konva, perfect-freehand, and html-to-image.
- Proxy now injects html-to-image and the new dyad-screenshot-client.js
for screenshot capture.

<sup>Written for commit 580aca271c5993a0dc7426e36e34393e073bd67b.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-13 19:40:31 +01:00
Will Chen
1ce399584e Use specific languages for shiki (#1938)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Refactors code highlighting to use react-shiki/core with a singleton
highlighter and preloaded langs/themes, adds a fallback renderer, bumps
react-shiki, and adds tests for message summarization.
> 
> - **Frontend**
> - **CodeHighlight** (`src/components/chat/CodeHighlight.tsx`): Replace
`useShikiHighlighter` with `ShikiHighlighter` from `react-shiki/core`
using a singleton `createHighlighterCore` and JS regex engine; preload
common languages and GitHub light/dark themes; add `<pre><code>`
fallback while loading.
> - **Tests**
> - Add/expand Vitest suite for `formatMessagesForSummary`
(`src/__tests__/formatMessagesForSummary.test.ts`): covers truncation,
ordering, special chars, undefined content, and edge cases.
> - **Dependencies**
>   - Upgrade `react-shiki` to `^0.9.0` in `package.json`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b32d224cd21d3c76e77799f2995905e523406bf9. 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
Preloaded a specific set of Shiki languages and themes using react-shiki
core, and updated CodeHighlight to use a singleton highlighter. This
reduces bundle size and stabilizes code rendering with a simple fallback
while loading.

- **Refactors**
- Switched to react-shiki/core with ShikiHighlighter and a singleton
highlighter.
- Preloaded common languages
(js/ts/jsx/tsx/html/css/json/markdown/python/etc.) and GitHub light/dark
themes.
- Used the JavaScript regex engine and added a plain <pre><code>
fallback until the highlighter is ready.

- **Dependencies**
  - Upgraded react-shiki to ^0.9.0.

<sup>Written for commit b32d224cd21d3c76e77799f2995905e523406bf9.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-11 23:06:04 -08:00
Adeniji Adekunle James
d3f3ac3ae1 Replace native Git with Dugite to support users without Git installed (#1760)
I moved all isomorphic-git usage into a single git_utils.ts file and
added Dugite as an alternative Git provider. The app now checks the
user’s settings and uses dugite when user enabled native git for all
isomorphic-git commands. This makes it easy to fully remove
isomorphic-git in the future by updating only git_utils.ts.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds Dugite-based native Git (bundled binary) and refactors all Git
calls to a unified git_utils API, replacing direct isomorphic-git usage
across the app.
> 
> - **Git Platform Abstraction**:
> - Introduces `dugite` and bundles Git via Electron Forge
(`extraResource`) with `LOCAL_GIT_DIRECTORY` setup in `src/main.ts`.
> - Adds `src/ipc/git_types.ts` and a comprehensive
`src/ipc/utils/git_utils.ts` wrapper supporting both Dugite (native) and
`isomorphic-git` (fallback): `commit`, `add`/`addAll`, `remove`, `init`,
`clone`, `push`, `setRemoteUrl`, `currentBranch`, `listBranches`,
`renameBranch`, `log`, `isIgnored`, `getCurrentCommitHash`,
`getGitUncommittedFiles`, `getFileAtCommit`, `checkout`,
`stageToRevert`.
> - **Refactors (switch to git_utils)**:
> - Replaces direct `isomorphic-git` imports in handlers and processors:
`app_handlers`, `chat_handlers`, `createFromTemplate`,
`github_handlers`, `import_handlers`, `portal_handlers`,
`version_handlers`, `response_processor`, `neon_timestamp_utils`,
`utils/codebase`.
> - Updates tests to mock `git_utils`
(`src/__tests__/chat_stream_handlers.test.ts`).
> - **Behavioral/Feature Updates**:
> - `createFromTemplate` uses `fetch` for GitHub API and `gitClone` for
cloning with cache validation.
> - GitHub integration uses `gitSetRemoteUrl`/`gitPush`/`gitClone`,
handling public vs token URLs and directory creation when native Git is
disabled.
> - Versioning, imports, app file edits, migrations now stage/commit via
`git_utils`.
> - **UI/Copy**:
>   - Updates Settings description for “Enable Native Git”.
> - **Config/Version**:
>   - Bumps version to `0.29.0-beta.1`; adds `dugite` dependency.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ba098f7f25d85fc6330a41dc718fbfd43fff2d6c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Will Chen <willchen90@gmail.com>
2025-12-09 19:01:25 -08:00
Mohamed Aziz Mejri
352d4330ed Visual editor (Pro only) (#1828)
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Prototype visual editing mode for the preview app. Toggle the mode, pick
elements (single or multiple), and edit margin, padding, border,
background, static text, and text styles with live updates, then save
changes back to code.

- **New Features**
- Pen tool button to enable/disable visual editing in the preview and
toggle single/multi select; pro-only.
- Inline toolbar anchored to the selected element for Margin (X/Y),
Padding (X/Y), Border (width/radius/color), Background color, Edit Text
(when static), and Text Style (font size/weight/color/font family).
- Reads computed styles from the iframe and applies changes in real
time; auto-appends px; overlay updates on scroll/resize.
- Save/Discard dialog batches edits and writes Tailwind classes to
source files via IPC; uses AST/recast to update className and text,
replacing conflicting classes by prefix; supports multiple components.
- New visual editor worker to get/apply styles and enable inline text
editing via postMessage; selector client updated for coordinates
streaming and highlight/deselect.
- Proxy injects the visual editor client; new atoms track selected
component, coordinates, and pending changes; component analysis flags
dynamic styling and static text.
  - Uses runtimeId to correctly target and edit duplicate components.

- **Dependencies**
  - Added @babel/parser for AST-based text updates.
  - Added recast for safer code transformations.

<sup>Written for commit cdd50d33387a29103864f4743ae7570d64d61e93.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-09 13:09:19 -08:00
Will Chen
e0f123b8e2 Bump react (internal) (#1893)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Upgrade React and React DOM to 19.2.1 and align related lockfile
entries (including scheduler).
> 
> - **Dependencies**:
> - Upgrade `react` to `^19.2.1` and `react-dom` to `^19.2.1` in
`package.json`.
> - Update lockfile resolutions for `react`, `react-dom`, and
`scheduler` (`0.27.0`), including peer/dependency ranges.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7085cd54e499a04e89f6325f4e274e19cdde4961. 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
Upgraded React and React DOM to 19.2.1 to adopt the latest fixes. No app
code changes.

- **Dependencies**
  - Bumped react and react-dom to ^19.2.1.
  - Updated scheduler to 0.27.0 via react-dom.

<sup>Written for commit 7085cd54e499a04e89f6325f4e274e19cdde4961.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-04 23:02:25 -08:00
Will Chen
f806414ec6 Fix Vercel API breaking change (#1883)
Fixes https://github.com/dyad-sh/dyad/issues/1652

This is kind of a hack because the Vercel SDK has a bug since their API
has subtly made a breaking change in the last month or so and the Vercel
SDK still hasn't been updated
https://github.com/vercel/sdk/issues/175#issuecomment-3608968116

Note: the Vercel SDK upgrade in this PR doesn't actually fix the issue,
but is probably good to do anyways.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Works around a breaking change in Vercel’s API by bypassing the SDK for
project queries. Restores listing, availability checks, and project
linking.

- **Bug Fixes**
  - Added a direct HTTP call to GET /v9/projects using the Vercel token.
- Replaced SDK calls in list, name availability, and connect-to-project
flows.
- Added minimal types and clearer error handling for project responses.

- **Dependencies**
- Bumped @vercel/sdk to 1.18.0. The upgrade doesn’t fix the bug but is
safe to adopt.

<sup>Written for commit 306af5c3f235f0ab9d87c809bb8cf54016a5d59f.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Replaces Vercel project retrieval with a direct HTTP helper used
across handlers to handle API changes, and updates @vercel/sdk to
^1.18.0.
> 
> - **IPC/Backend (Vercel)**:
> - Add `getVercelProjects` helper to fetch projects via `GET
/v9/projects`, mimicking `vercel.projects.getProjects`.
>   - Update handlers to use the new helper:
>     - `vercel:list-projects` (`handleListVercelProjects`)
>     - `vercel:is-project-available` (`handleIsProjectAvailable`)
> - `vercel:connect-existing-project` (`handleConnectToExistingProject`)
> - Add lightweight types: `VercelProjectResponse`,
`GetVercelProjectsResponse`.
> - **Dependencies**:
>   - Bump `@vercel/sdk` to `^1.18.0`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
306af5c3f235f0ab9d87c809bb8cf54016a5d59f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-12-03 14:32:01 -08:00
Will Chen
c4591996ea Release 0.27.x (#1768)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Bumps app to version 0.27.1 and updates
`@dyad-sh/supabase-management-js` to 1.0.1.
> 
> - **Release**:
>   - Set application version to `0.27.1` in `package.json`.
> - **Dependencies**:
> - Update `@dyad-sh/supabase-management-js` from `v1.0.0` to `v1.0.1`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a6d43949556f1b3da905b02e5c84a05bd30539b4. 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
Release 0.27.1: update app version and lockfile. Also bump the Supabase
management client to v1.0.1.

- **Dependencies**
  - @dyad-sh/supabase-management-js: v1.0.0 → v1.0.1

<sup>Written for commit a6d43949556f1b3da905b02e5c84a05bd30539b4.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-11-13 13:19:06 -08:00
Will Chen
ae1ec68453 Fuzzy turbo edits (#1700)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Makes search-replace tolerant to typos/whitespace via two-pass fuzzy
matching with Levenshtein and smart-quote normalization, with clearer
errors and tests.
> 
> - **Search/Replace Processor
(`src/pro/main/ipc/processors/search_replace_processor.ts`)**
> - Add two-pass fuzzy matching: quick exact-line prefilter +
Levenshtein scoring (`fastest-levenshtein`).
> - Match flow: exact > whitespace-insensitive > fuzzy; detect ambiguity
and improve error messages with similarity %.
> - Introduce thresholds and limits: `FUZZY_MATCH_THRESHOLD=0.9`,
`EARLY_STOP_THRESHOLD=0.95`, `MAX_FUZZY_SEARCH_TIME_MS=10000`.
> - Normalize text before scoring using `normalizeString` (handles
quotes, dashes, ellipsis, NBSP, soft hyphen, BOM).
> - Preserve indentation for replacements; keep existing
unescape/validation logic.
> - **Utils (`src/utils/text_normalization.ts`)**
> - New `normalizeString` helper for Unicode normalization used by fuzzy
matching.
> - **Tests
(`src/pro/main/ipc/processors/search_replace_processor.test.ts`)**
> - Add cases for typos, smart quotes, below-threshold failure,
exact-over-fuzzy preference, whitespace differences, and ambiguity.
> - **Dependencies**
>   - Add `fastest-levenshtein` to `package.json`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
289dab915c37bc4f9ab4bf0209ff3f95a57341fc. 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
Makes applySearchReplace more tolerant by preferring exact and
whitespace-insensitive matches, then falling back to fast two-pass
Levenshtein-based fuzzy matching with Unicode normalization. Improves
failure messages and adds tests to cover common edit scenarios.

- **New Features**
- Exact > whitespace-insensitive > fuzzy matching flow (threshold 0.9).
- Two-pass fuzzy search with exact-line prefilter; early stop at 0.95
and 10s timeout.
- normalizeString handles smart quotes, dashes, ellipsis, NBSPs, soft
hyphen, and BOM.
  - Errors now report best fuzzy similarity when below threshold.
- Tests for typos, smart quotes, below-threshold cases,
exact-over-fuzzy, whitespace differences, and ambiguity.

- **Dependencies**
  - Add fastest-levenshtein.

<sup>Written for commit 289dab915c37bc4f9ab4bf0209ff3f95a57341fc.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-11-04 09:30:25 -08:00
Will Chen
cc435d1ed4 Bump better better-sqlite (#1595)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Bumps app to 0.25.0-beta.1 and upgrades better-sqlite3 to 12.4.1 with
updated engine constraints.
> 
> - **Versioning**: Set `package.json` and lockfile version to
`0.25.0-beta.1`.
> - **Dependencies**:
> - Upgrade `better-sqlite3` from `^11.9.1` to `^12.4.1` (lockfile
resolves to `12.4.1`).
> - Add/update `better-sqlite3` engine constraints to `node: 20.x ||
22.x || 23.x || 24.x`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e45156ac3a3340c68ef61200416860a0175eb4b6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-20 15:33:36 -07:00
Will Chen
0a1ef3cc55 Electron 38 (#1526)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is
generating a summary for commit
48563edb9143b6a53957e7ac8901fac3408e444c. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-13 19:19:45 -07:00
Adeniji Adekunle James
348521ce82 GitHub Import Feature: Import repositories/projects from GitHub (#1424) (#1454)
## Summary
Adds the ability to import GitHub repositories directly into Dyad from
the home screen, complementing the existing local folder import feature.
- GitHub Import Modal: New modal accessible from home screen via "Import
from Github" button with two Import methods
- Select project from GitHub repositories list
- Clone from any GitHub URL
- Advanced Options: Optional custom install/start commands (defaults to
project's package.json scripts)
- Auto AI_RULES Generation: Automatically generates AI_RULES.md if not
present in imported repo

closes #1424
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Adds a GitHub import flow from the home screen so users can clone repos
via their list or any URL, with optional install/start commands and
automatic AI_RULES.md generation. Addresses Linear #1424 by enabling
seamless project setup from GitHub.

- **New Features**
  - Import modal with two tabs: Your Repositories and From URL.
- Advanced options for install/start commands with validation; defaults
used when both are empty.
- After cloning, navigate to chat and auto-generate AI_RULES.md if
missing.
- New IPC handler github:clone-repo-from-url with token auth support,
plus IpcClient method and preload channel.
- E2E tests cover modal open, auth, import via URL/repo list, and
advanced options.

- **Dependencies**
  - Added @radix-ui/react-tabs for the modal tab UI.

<!-- End of auto-generated description by cubic. -->
2025-10-13 19:10:04 -07:00
Will Chen
a0606996fc Fix package lock (#1335)
#1028 caused some issues in the package-lock.json. This should fix that
2025-09-19 22:05:36 -07:00
Will Chen
6d3c397d40 Add MCP support (#1028) 2025-09-19 15:43:39 -07:00
Will Chen
7818f2950a Chat search (#1224)
Based on https://github.com/dyad-sh/dyad/pull/1116
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Adds a fast chat search dialog (Command Palette) to find and jump
between chats. Open via the sidebar button or Ctrl/Cmd+K, with title and
message text search plus inline snippets.

- New Features
  - Command palette using cmdk with keyboard shortcut (Ctrl/Cmd+K).
- Searches within the selected app across chat titles and message
content via a new IPC route (search-chats).
- Debounced queries (150ms) with React Query; results de-duplicated and
sorted by newest.
- Snippet preview with highlighted matches and custom ranking; selecting
a result navigates and closes the dialog.
- Search button added to ChatList; basic e2e tests added (currently
skipped).

- Dependencies
  - Added cmdk@1.1.1.
- Bumped @radix-ui/react-dialog to ^1.1.15 and updated Dialog to support
an optional close button.

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Evans Obeng <iamevansobeng@outlook.com>
Co-authored-by: Evans Obeng <60653146+iamevansobeng@users.noreply.github.com>
2025-09-09 00:18:48 -07:00
Will Chen
d21497659b Fix package-lock.json & merges (#1227)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Regenerated package-lock.json to fix inconsistencies and align with
package.json. This restores reproducible installs locally and in CI.

- **Migration**
  - Run npm ci to install with the updated lockfile.
  - If install issues persist, delete node_modules and retry.

<!-- End of auto-generated description by cubic. -->
2025-09-09 00:17:55 -07:00
Adeniji Adekunle James
f8ec10ec6b feat: add xAI (Grok) as AI provider (#1209)
# Add xAI (Grok) Provider Support

## Overview
This PR adds support for xAI's Grok models as an AI provider, focusing
on coding-optimized models.

## Changes Made

### Provider Configuration (`language_model_helpers.ts`)
- Added xAI to `MODEL_OPTIONS` with 3 coding-focused models:
  - `grok-code-fast-1`: Fast, economical coding model (256k context)
  - `grok-4`: Most capable flagship model (256k context)
  - `grok-3`: Powerful coding model (131k context)

<img width="805" height="592" alt="image"
src="https://github.com/user-attachments/assets/a99b9495-e90e-40f3-a772-be9807b24501"
/>


<img width="805" height="653" alt="image"
src="https://github.com/user-attachments/assets/aad7b333-ee74-457a-b5b7-5d20bd54d7e0"
/>

## Dependencies
- Requires `@ai-sdk/xai` package (already imported)
- Uses existing provider pattern and infrastructure


## Why xAI for Coding?
xAI's Grok models have shown impressive results in coding benchmarks:
- Trained on high-quality programming datasets reflecting real-world
tasks
- Excels at agentic coding workflows with fast reasoning capabilities
- Strong performance across multiple programming languages (TypeScript,
Python, Java, Rust, C++, Go)
- Achieved 70.8% on SWE-Bench-Verified using internal evaluation
- Optimized for rapid iteration in development environments
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Adds xAI (Grok) as a provider so users can pick Grok coding models in
the app. Integrates provider config, client wiring, and schema updates.

- **New Features**
- Added xAI provider with env var mapping (XAI_API_KEY) and provider
metadata.
- Exposed models: grok-code-fast-1 (256k), grok-4 (256k), grok-3 (131k).
  - Hooked up get_model_client to use @ai-sdk/xai (createXai).
  - Included "xai" in validation schemas and model options.

- **Migration**
  - Set XAI_API_KEY to enable xAI.

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Will Chen <willchen90@gmail.com>
2025-09-08 23:01:59 -07:00
Samrat Jha
938595aab2 Add support for Amazon Bedrock provider (#1185)
- follows existing patterns for AI SDK to provide Bedrock integration
- Uses Bedrock's API token feature for authentication which provides a
standard experience
- bedrock provided models match the Anthropic provided models (for now)


**Disclaimer**: The contributing docs are extremely sparse. I don't
actually know how to build this and get this running in Electron


## Testing

- AWS Bedrock provider is available for selection
<img width="994" height="496" alt="image"
src="https://github.com/user-attachments/assets/3cb21fed-9826-40e5-8019-b2b5df5e873b"
/>

- The provider settings also show the right models and offer the right
env variable to use
<img width="949" height="862" alt="image"
src="https://github.com/user-attachments/assets/8c23d5c8-d84d-4bf7-856a-8dc8d9d6c4b4"
/>


    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Adds AWS Bedrock as a provider so users can run Claude models via
Bedrock with API token authentication. The settings now list Bedrock
with supported models and a new env var.

- New Features
- New provider: bedrock using @ai-sdk/amazon-bedrock, wired into model
client and schemas.
- Models: Claude 4 Sonnet, Claude 3.7 Sonnet, Claude 3.5 Sonnet (Bedrock
model IDs).
- Settings: shows AWS Bedrock with correct models and env var
AWS_BEARER_TOKEN_BEDROCK.
  - Default region: us-east-1.

- Migration
  - Set AWS_BEARER_TOKEN_BEDROCK with your Bedrock API token.
  - Select AWS Bedrock in settings and pick a model.

<!-- End of auto-generated description by cubic. -->

Co-authored-by: Samrat Jha <samratj@amazon.com>
Co-authored-by: Will Chen <willchen90@gmail.com>
2025-09-08 22:52:12 -07:00
Md Rakibul Islam Rocky
4db6d63b72 Add Google Vertex AI provider (#1163)
# Summary

* Adds first-class **Google Vertex AI provider** using
`@ai-sdk/google-vertex`.
* Supports **Gemini 2.5** models and partner **MaaS (Model Garden)**
models via full publisher IDs.
* New **Vertex-specific settings UI** for Project, Location, and Service
Account JSON.
* Implements a **“thinking” toggle** for Gemini 2.5 Flash

  * Pro: always on
  * Flash: toggleable
  * Flash Lite: none
* Fixes *“AI not found”* for Vertex built-ins by mapping to
`publishers/google` paths.
* Hardens **cross-platform file ops** and ensures all tests pass.

---

# What’s New

### Vertex AI Provider

* Uses `@ai-sdk/google-vertex` with `googleAuthOptions.credentials` from
pasted Service Account JSON.
* Configurable **project** and **location**.
* Base URL → `/projects/{project}/locations/{location}`

  * Built-ins: `publishers/google/models/<id>`
  * Partner MaaS: `publishers/<partner>/models/...`

### Built-in Vertex Models

* `gemini-2.5-pro`
* `gemini-2.5-flash`
* `gemini-2.5-flash-lite`

### Thinking Behavior

* Vertex + Google marked as thinking-capable.
* Pro: always thinking
* Flash: toggle in UI
* Flash Lite: none

### Vertex Settings UI

* New **Google Vertex AI panel** for Project ID, Location, Service
Account JSON.
* Keys encrypted like other secrets.

---

# Fixes

* **Model resolution:** built-ins auto-map to
`publishers/google/models/<id>`.
* **Partner MaaS support:** full publisher IDs work directly (e.g.
DeepSeek).
* **Cross-platform paths:** normalize file ops with `toPosixPath`,
preserve `safeJoin` semantics.

---

# Why This Is Better

* Users can select **Vertex alongside other providers**.
* **More models** available through Model Garden.
* **Dedicated setup UI** reduces misconfig.
* **Thinking toggle** gives control over cost vs. reasoning depth.

---

# Files Changed

* **Provider & Models**: `language_model_helpers.ts`,
`get_model_client.ts`
* **Streaming**: `chat_stream_handlers.ts`
* **Schemas & Encryption**: `schemas.ts`, `settings.ts`
* **Settings UI**: `VertexConfiguration.tsx`, `ApiKeyConfiguration.tsx`
* **Models UI**: `ModelsSection.tsx` (Flash toggle)
* **Setup Detection**: `useLanguageModelProviders.ts`
* **Path Utils**: `path_utils.ts`, `response_processor.ts`
* **Deps**: `package.json` → `@ai-sdk/google-vertex@3.0.16`

---

# Tests & Validation

* **TypeScript**: `npm run ts` → 
* **Lint**: `npm run lint` → 
* **Unit tests**: `npm test` →  231 passed, 0 failed

---

# Migration / Notes

* No breaking changes.
* For Vertex usage:

  * Ensure Vertex AI API is enabled.
  * Service Account needs `roles/aiplatform.user`.
  * Region must support model (e.g. `us-central1`).
* Thinking toggle currently affects **only** Gemini 2.5 Flash.

---

# Manual QA

1. Configure Vertex with Project/Location/Service Account JSON.
2. Test built-ins:

   * `gemini-2.5-pro`
   * `gemini-2.5-flash` (toggle on/off)
   * `gemini-2.5-flash-lite`
3. Test MaaS partner model (e.g., DeepSeek) via full publisher ID.
4. Verify other providers remain unaffected.
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Adds a first-class Google Vertex AI provider with Gemini 2.5 models, a
Vertex settings panel, and a “thinking” toggle for Gemini 2.5 Flash.
Also fixes model resolution for Vertex and hardens cross-platform file
operations.

- **New Features**
- Vertex AI provider via @ai-sdk/google-vertex with project, location,
and service account JSON.
- Built-in models: gemini-2.5-pro, gemini-2.5-flash,
gemini-2.5-flash-lite.
- “Thinking” support: Pro always on; Flash toggle in Models UI; Flash
Lite none.
- MaaS partners supported via full publisher paths (e.g.,
publishers/<partner>/models/...).
  - Vertex settings UI with encrypted service account key storage.

- **Bug Fixes**
  - Built-in Vertex models auto-map to publishers/google/models/<id>.
  - Consistent file ops across platforms using toPosixPath.
- Vertex readiness detection requires project/location/service account
JSON.
- Streaming “thinking” behavior respects Vertex Flash toggle and Pro
always-on.

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Md Rakibul Islam Rocky <mdrirocky08@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Will Chen <willchen90@gmail.com>
2025-09-08 22:41:12 -07:00
顾颢
06d79f89ac chore: add Windows compatibility for npm scripts (#1170)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Make npm scripts work on Windows by replacing rm -rf with rimraf and
using cross-env for environment variables. This enables local dev and
packaging on Windows without WSL.

- **Refactors**
- Changed clean to use rimraf and delete out and scaffold/node_modules.
- Prefixed dev:engine, staging:engine, and staging:gateway with
cross-env.

- **Dependencies**
  - Added rimraf ^6.0.1. Run npm install.

<!-- End of auto-generated description by cubic. -->

Co-authored-by: 顾颢 <guhao@dayee.com>
2025-09-03 14:57:30 -07:00
Will Chen
1c0255ab12 Enable iframe sandbox (#1178)
This allows almost all the iframe sandbox tokens
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#sandbox
except notably for allow-top-navigation*

Note: allow-same-origin should be OK because the main window is under
the `file://` origin while the iframe window is served on
`localhost:####`

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Enable sandboxing on the preview iframe to isolate preview content while
preserving needed capabilities (allow-same-origin, scripts, forms,
popups, modals, orientation/pointer lock, presentation, downloads).
Top-level navigation remains disallowed; allow-same-origin is safe
because the app is file:// and the iframe runs on localhost.

<!-- End of auto-generated description by cubic. -->
2025-09-03 14:17:50 -07:00
Tanner-Maasen
2ffbbbca8f Add Azure OpenAI Custom Model Integration (#1001)
Fixes #710 

This PR implements comprehensive Azure OpenAI integration for Dyad,
enabling users to leverage Azure
OpenAI models through proper environment variable configuration. The
implementation adds Azure as a
supported provider with full integration into the existing language
model architecture, including support
  for GPT-5 models. Key features include environment-based
configuration using `AZURE_API_KEY` and `AZURE_RESOURCE_NAME`,
specialized UI components that provide clear
setup instructions and status indicators, and seamless integration with
Dyad's existing provider system.
The Azure provider leverages the @ai-sdk/azure package (v1.3.25) for
compatibility with the current
  TypeScript language model interfaces.

The implementation includes robust error handling for missing
configuration, comprehensive test coverage
with 9 new unit tests covering critical functionality like model client
creation and error scenarios, and
  an E2E test for the Azure-specific settings UI. 

<img width="1510" height="908" alt="Screenshot 2025-08-18 at 9 14 32 PM"
src="https://github.com/user-attachments/assets/04aa99e1-1590-4bb0-86c9-a67b97bc7500"
/>

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Will Chen <willchen90@gmail.com>
2025-08-30 20:47:25 -07:00
Will Chen
8211db71c9 bump to beta v0.19 1 (#1094) 2025-08-26 11:09:17 -07:00
Will Chen
d535db6251 Upgrade to AI sdk with codemod (#1000) 2025-08-18 22:21:27 -07:00
Will Chen
b8362a74a7 bump to v0.17.0 beta 2 (#932) 2025-08-13 16:24:15 -07:00
Will Chen
a6dca76d29 Allow referencing other apps (#692)
- [x] Update chat_stream_handlers
- [x] Update token handlers
- [x] Update HomeChatInput
- [x] update lexical chat input: do not allow referencing same app
(current app, or other already selected apps)
- [x] I don't think smart context will work on this...
- [x] Enter doesn't clear...
2025-08-13 16:22:49 -07:00
Will Chen
ab757d2b96 Add GPT 5 support (#902) 2025-08-11 15:00:02 -07:00
Abdur Rahman
bbc50197c2 fix: improve close button alignment in chat error containers (#782)
Adjusted positioning to top-2.5 left-2 and add left padding to prevent
text overlap with the close button. 

<img width="715" height="61" alt="image"
src="https://github.com/user-attachments/assets/1e47f577-2b11-4928-82a6-053abc77dd1e"
/>

<img width="727" height="101" alt="image"
src="https://github.com/user-attachments/assets/b6058eca-93e0-445e-b17a-dee81911b90b"
/>
2025-08-05 14:34:17 -07:00
Will Chen
b0f08eaf15 Neon / portal template support (#713)
TODOs:
- [x] Do restart when checkout / restore if there is a DB
- [x] List all branches (branch id, name, date)
- [x] Allow checking out versions with no DB
- [x] safeguard to never delete main branches
- [x] create app hook for neon template
- [x] weird UX with connector on configure panel
- [x] tiny neon logo in connector
- [x] deploy to vercel
- [x] build forgot password page
- [x] what about email setup
- [x] lots of imgix errors
- [x] edit file - db snapshot
- [x] DYAD_DISABLE_DB_PUSH
- [ ] update portal doc
- [x] switch preview branch to be read-only endpoint
- [x] disable supabase sys prompt if neon is enabled
- [ ] https://payloadcms.com/docs/upload/storage-adapters
- [x] need to use main branch...

Phase 2?
- [x] generate DB migrations
2025-08-04 16:36:09 -07:00
Will Chen
a6e0ea2f73 Upgrade oxlint and disable line (#690)
side note: test.only check doesn't work because oxlint hardcodes to find
jest
https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/utils/jest/parse_jest_fn.rs#L317
2025-07-31 13:02:29 -07:00
Will Chen
444397ea86 Create Publish panel to easy GitHub and Vercel push (#655) 2025-07-17 15:54:08 -07:00
Will Chen
ab6a9d3b34 Disable auto-update setting & settings page has scroll shortcuts (#590)
Fixes https://github.com/dyad-sh/dyad/issues/561
2025-07-07 15:43:06 -07:00
Will Chen
30b5c0d0ef Replace thinking with native Gemini thinking summaries (#400)
This uses Gemini's native [thinking
summaries](https://cloud.google.com/vertex-ai/generative-ai/docs/thinking#thought-summaries)
which were recently added to the API.

Why? The grafted thinking would sometimes cause weird issues where the
model, especially Gemini 2.5 Flash, got confused and put dyad tags like
`<dyad-write>` inside the `<think>` tags.

This also improves the UX because you can see the native thoughts rather
than having the Gemini response load for a while without any feedback.

I tried adding Anthropic extended thinking, however it requires temp to
be set at 1, which isn't ideal for Dyad's use case where we need precise
syntax following.
2025-06-16 17:29:32 -07:00
Will Chen
c1aa6803ce Click to edit UI (#385)
- [x] add e2e test - happy case (make sure it clears selection and next
prompt is empty, and preview is cleared); de-selection case
- [x] shim - old & new file
- [x] upgrade path
- [x] add docs
- [x] add try-catch to parser script
- [x] make it work for next.js
- [x] extract npm package
- [x] make sure plugin doesn't apply in prod
2025-06-11 13:05:27 -07:00
Will Chen
534cbad909 Allow manual context management (#376) 2025-06-10 13:52:20 -07:00
Will Chen
7f410ce830 Better supabase error message (#336)
Fixes #287
2025-06-04 22:22:00 -07:00
Will Chen
7235eab227 Make CI run cross-platform (#295) 2025-06-03 13:04:16 -07:00
Will Chen
509e044137 Boilerplate free tests (#277) 2025-05-28 22:55:54 -07:00
Will Chen
644012c9a5 Simple playwright e2e test (#234) 2025-05-23 10:44:52 -07:00
Will Chen
5966dd7f4b Proxy server to inject shim (#178)
things to test:

- [x] allow real URL to open in new window
- [x] packaging in electron?
- [ ] does it work on windows?
- [x] make sure it works with older apps
- [x] what about cache / reuse? - maybe use a bigger range of ports??
2025-05-16 23:28:26 -07:00
Will Chen
ea9301c771 Support delete custom model (#136) 2025-05-12 16:37:39 -07:00
Will Chen
79a2b5a906 Fix markdown parsing & remove rehypeRaw (#130)
Fixes #121
2025-05-12 13:52:54 -07:00
Will Chen
34ac9df743 Refactor useVersions to @tanstack/react-query (#114)
working
2025-05-08 22:04:20 -07:00
Will Chen
2537fbb342 lint using oxlint (#106) 2025-05-08 17:21:35 -07:00
Will Chen
0e8cc26fb5 Add prettier hook & contribution guide (#105) 2025-05-06 23:15:56 -07:00
Will Chen
0d56651220 Run prettier on everything (#104) 2025-05-06 23:02:28 -07:00
Will Chen
971afb835f Bump to v0.4.0 (#85) 2025-05-05 15:10:18 -07:00
Will Chen
a6eaaa6a94 Regenrate package-lock.json 2025-05-02 14:59:16 -07:00
Piotr Wilkin (ilintar)
5fc49231ee Add LM Studio support (#22) 2025-05-02 14:51:32 -07:00