Commit Graph

72 Commits

Author SHA1 Message Date
Will Chen
c50527b4c0 Security Panel MVP (#1660)
TODOs:

- [x] Add documentation
- [x] e2e tests: run security review, update knowledge, and fix issue
- [x] more stringent risk rating


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduces a new Security mode with a Security Review panel that runs
reviews, edits rules, parses findings via IPC, and supports fixing
issues, with tests and prompt/runtime support.
> 
> - **UI/Preview Panel**:
> - Add `security` preview mode to `previewModeAtom` and ActionHeader
(Shield button).
> - New `SecurityPanel` showing findings table (sorted by severity), run
review, fix issue flow, and edit `SECURITY_RULES.md` dialog.
>   - Wire into `PreviewPanel` content switch.
> - **Hooks**:
>   - `useSecurityReview(appId)`: fetch latest review via IPC.
> - `useStreamChat`: add `onSettled` callback to invoke refreshes after
streams.
> - **IPC/Main**:
> - `security_handlers`: `get-latest-security-review` parses
`<dyad-security-finding>` from latest assistant message.
>   - Register handler in `ipc_host`; expose channel in `preload`.
>   - `ipc_client`: add `getLatestSecurityReview(appId)`.
> - `chat_stream_handlers`: detect `/security-review`, use dedicated
system prompt, optionally append `SECURITY_RULES.md`, suppress
Supabase-not-available note in this mode.
> - **Prompts**:
> - Add `SECURITY_REVIEW_SYSTEM_PROMPT` with structured finding output.
> - **Supabase**:
> - Enhance schema query to include `rls_enabled`, split policy
`using_clause`/`with_check_clause`.
> - **E2E Tests**:
> - New `security_review.spec.ts` plus snapshots and fixture findings;
update test helper for `security` mode and findings table snapshot.
> - Fake LLM server streams security findings for `/security-review` and
increases batch size.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5022d01e22a2dd929a968eeba0da592e0aeece01. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-29 17:32:52 -07:00
Will Chen
a8f3c97396 Turbo edits v2 (#1653)
Fixes #1222 #1646 

TODOs
- [x] description?
- [x] collect errors across all files for turbo edits
- [x] be forgiving around whitespaces
- [x] write e2e tests
- [x] do more manual testing across different models



<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds Turbo Edits v2 search-replace flow with settings/UI selector,
parser/renderer, dry-run validation + fallback, proposal integration,
and comprehensive tests; updates licensing.
> 
> - **Engine/Processing**:
> - Add `dyad-search-replace` end-to-end: parsing
(`getDyadSearchReplaceTags`), markdown rendering (`DyadSearchReplace`),
and application (`applySearchReplace`) with dry-run validation and
fallback to `dyad-write`.
> - Inject Turbo Edits v2 system prompt; toggle via
`isTurboEditsV2Enabled`; disable classic lazy edits when v2 is on.
> - Include search-replace edits in proposals and full-response
processing.
> - **Settings/UI**:
> - Introduce `proLazyEditsMode` (`off`|`v1`|`v2`) and helper selectors;
update `ProModeSelector` with Turbo Edits and Smart Context selectors
(`data-testid`s).
> - **LLM/token flow**:
> - Construct system prompt conditionally; update token counting and
chat stream to validate and repair search-replace responses.
> - **Tests**:
> - Add unit tests for search-replace processor; e2e tests for Turbo
Edits v2 and options; fixtures and snapshots.
> - **Licensing/Docs**:
> - Add `src/pro/LICENSE` (FSL 1.1 ALv2 future), update root `LICENSE`
and README license section.
> - **Tooling**:
> - Update `.prettierignore`; enhance test helpers (selectors, path
normalization, snapshot filtering).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7aefa02bfae2fe22a25c7d87f3c4c326f820f1e6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-28 11:36:20 -07:00
Adeniji Adekunle James
d76f428447 UI improvement: make edit and delete buttons visible for custom AI provider (#1535)
- Move edit and delete actions from hidden popover to visible buttons
- Restructure card layout: status badge and action buttons at top, title
below

<img width="1029" height="414" alt="image"
src="https://github.com/user-attachments/assets/60497f87-254e-4f4d-9f8c-ea73b8f2526e"
/>

closes #1358


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

## Summary by cubic
Made edit and delete always visible on custom provider cards and
restructured the card layout for clearer actions and status. Improves
discoverability and aligns with #1358.

- **Refactors**
- Replaced popover menu with visible Edit and Delete icon buttons
(data-testid: edit-custom-provider, delete-custom-provider).
- Moved status badge and actions to the top; title now sits below;
badges don’t wrap.
- Updated e2e tests to use new buttons and adjusted selectors for the
updated heading.

<!-- End of auto-generated description by cubic. -->
2025-10-14 16:58:09 -07:00
Will Chen
9691c9834b Support concurrent chats (#1478)
Fixes #212 


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Add concurrent chat support with per-chat state, chat activity UI, IPC
per-chat handling, and accompanying tests.
> 
> - **Frontend (Chat concurrency)**
> - Replace global chat atoms with per-chat maps:
`chatMessagesByIdAtom`, `isStreamingByIdAtom`, `chatErrorByIdAtom`,
`chatStreamCountByIdAtom`, `recentStreamChatIdsAtom`.
> - Update `ChatPanel`, `ChatInput`, `MessagesList`,
`DyadMarkdownParser`, and `useVersions` to read/write per-chat state.
> - Add `useSelectChat` to centralize selecting/navigating chats; wire
into `ChatList`.
> - **UI**
> - Add chat activity popover: `ChatActivityButton` and list; integrate
into `preview_panel/ActionHeader` (renamed from `PreviewHeader`) and
swap in `TitleBar`.
> - **IPC/Main**
> - Send error payloads with `chatId` on `chat:response:error`; update
`ipc_client` to route errors per chat.
> - Persist streaming partial assistant content periodically; improve
cancellation/end handling.
> - Make `FileUploadsState` per-chat (`addFileUpload({chatId,fileId},
...)`, `clear(chatId)`, `getFileUploadsForChat(chatId)`); update
handlers/processors accordingly.
> - **Testing**
> - Add e2e `concurrent_chat.spec.ts` and snapshots; extend helpers
(`snapshotMessages` timeout, chat activity helpers).
> - Fake LLM server: support `tc=` with options, optional sleep delay to
simulate concurrency.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9035f30b73a1f2e5a366a0cac1c63411742b16f3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-09 10:51:01 -07:00
Will Chen
6d3c397d40 Add MCP support (#1028) 2025-09-19 15:43:39 -07:00
Adeniji Adekunle James
2edd122d9b Feat: Add inline code editor (#1156) (#1232) (#1220) (#1235)
## 🚀 Feature: Inline Code Editor

This PR adds a comprehensive inline code editing experience to the
DyadWrite component.

###  What's New

- **Inline Monaco Editor**: Edit code directly within the component
using Monaco Editor
- **Cancel/Revert**: Cancel changes and revert to original code state
- **Language Detection**: Automatic syntax highlighting based on file
extensions
- **Theme Support**: Proper dark/light mode theming integration



https://github.com/user-attachments/assets/c44ab622-6b86-403c-904d-3f327f9719e8


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

## Summary by cubic
Adds an inline Monaco-based code editor to DyadWrite so users can edit
code blocks in place, then save or cancel changes. Saves stream edits
back to the chat as a dyad-edit block.

- **New Features**
- Inline editor with Edit, Save, and Cancel; preserves original code and
auto-expands when editing.
  - Language detection from file extension and dark/light theme support.
- Save streams edits via useStreamChat as <dyad-edit
path="...">...</dyad-edit> tied to the selected chat.
- Non-edit view still uses CodeHighlight; visibility toggle and
in-progress state respected.

- **Refactors**
- ChatMessage now uses DyadMarkdownParser instead of
VanillaMarkdownParser.

<!-- End of auto-generated description by cubic. -->
2025-09-16 23:03:22 -07:00
Will Chen
9bc5e1387a Fix Azure e2e test so it doesn't leak (#1248)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Scoped Azure e2e test env setup to prevent leaking variables across
tests. Added testWithConfigSkipIfWindows and moved Azure env vars into a
per-test preLaunchHook; the Azure test now skips on Windows.

<!-- End of auto-generated description by cubic. -->
2025-09-10 14:48:15 -07:00
Will Chen
7150082f5a Add OpenRouter to setup banner (#1242)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Added OpenRouter as a first-class option in the setup banner and
introduced a reusable provider card component. This streamlines provider
selection and adds E2E coverage for the setup flow.

- **New Features**
- Added SetupProviderCard and used it for Google and OpenRouter in
SetupBanner.
- Clicking Google or OpenRouter routes to the correct provider settings
and logs PostHog events.
  - Kept “Other providers” link to Settings.
- Added setup.spec.ts E2E test to verify Google, OpenRouter, and Other
navigation; introduced test config flag showSetupScreen to control the
OPENAI_API_KEY shortcut.

<!-- End of auto-generated description by cubic. -->
2025-09-10 13:00:31 -07:00
Will Chen
2842c61f7c Improve model picker UX (#1180)
1. Show less common AI providers (secondary) in submenu
2. Show $ signs for rough cost guide
3. Show "Pro" for supported AI providers with Pro is enabled

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

## Summary by cubic
Improves the Model Picker UX by grouping less-used providers under an
“Other AI providers” submenu and adding clear cost and Pro indicators.
This makes picking models faster and more informative.

- **New Features**
- Grouped secondary providers under “Other AI providers” using a new
provider.secondary flag (Azure marked secondary).
- Added rough cost hints: models can set dollarSigns and the UI shows a
“$” badge accordingly.
- Shows a “Pro” badge on supported cloud providers when Pro is enabled;
added a “Custom” badge for custom providers.
- Extended types: LanguageModelProvider.secondary and
LanguageModel.dollarSigns; populated values across OpenAI, Anthropic,
Google, and OpenRouter.

<!-- End of auto-generated description by cubic. -->
2025-09-03 15:36:54 -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
d8e54d9a10 Parameterize sys prompt (#1082)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Parameterized the system prompt and tokenized it in e2e dumps to make
snapshots smaller and stable. No runtime behavior changes; future prompt
edits won’t churn tests.

- **Refactors**
- Exported BUILD_SYSTEM_PREFIX and BUILD_SYSTEM_POSTFIX from
system_prompt.ts.
- Updated test_helper to replace the full prompt with
${BUILD_SYSTEM_PREFIX}/${BUILD_SYSTEM_POSTFIX} tokens in message dumps.
- Regenerated e2e snapshots to use tokens, reducing ~270 lines per
snapshot.

<!-- End of auto-generated description by cubic. -->
2025-08-25 17:56:14 -07:00
Will Chen
4e9a927a7b smart context v3 (#1022)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Adds Smart Context v3 with selectable modes (Off, Conservative,
Balanced) and surfaces token savings in chat. Also improves token
estimation by counting per-file tokens when Smart Context is enabled.

- **New Features**
- Smart Context selector in Pro settings with three options.
Conservative is the default when enabled without an explicit choice.
- New setting: proSmartContextOption ("balanced"); undefined implies
Conservative.
- Engine now receives enable_smart_files_context and smart_context_mode.
- Chat shows a DyadTokenSavings card when the message contains
token-savings?original-tokens=...&smart-context-tokens=..., with percent
saved and a tooltip for exact tokens.
- Token estimation uses extracted file contents for accuracy when Pro +
Smart Context is on; otherwise falls back to formatted codebase output.

<!-- End of auto-generated description by cubic. -->
2025-08-20 14:16:07 -07:00
Will Chen
573642ae5f Prompt gallery (#957)
- [x] show prompt instead of app in autocomplete
- [x] use proper array/list for db (tags)
- [x] don't do <dyad-prompt> - replace inline
2025-08-18 13:25:11 -07:00
Will Chen
8ef84285fc Shard E2E tests (#941) 2025-08-14 13:48:27 -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
5db0b04400 Support exclude paths in manual context management (#774) 2025-08-05 14:33:39 -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
e947eede7a community templates (#691) 2025-07-23 10:11:16 -07:00
Will Chen
2c284d0f20 Allow configuring environmental variables in panel (#626)
- [ ] Add test cases
2025-07-11 10:52:52 -07:00
Will Chen
4b84b12fe3 Extract panel header to title bar (#625) 2025-07-10 16:37:05 -07:00
Will Chen
5f3dea6180 Make capacitor tests version-resilient (#624) 2025-07-10 14:37:46 -07:00
Will Chen
72fd504f4a Skip git check in windows & longer timeout (#622) 2025-07-10 10:53:07 -07:00
Will Chen
dfdd267f53 Backup Dyad on new versions (#595) 2025-07-08 11:38:06 -07:00
Will Chen
a93536386b Support Beta release channel (#591) 2025-07-07 17:15:02 -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
a9575abc01 Rebaseline tests (#568) 2025-07-03 22:42:40 -07:00
Will Chen
678cd3277e Problems: auto-fix & problem panel (#541)
Test cases:
- [x] create-ts-errors
  - [x] with auto-fix
  - [x] without auto-fix 
- [x] create-unfixable-ts-errors
- [x] manually edit file & click recheck
- [x] fix all
- [x] delete and rename case

THINGS
- [x] error handling for checkProblems isn't working as expected
- [x] make sure it works for both default templates (add tests) 
- [x] fix bad animation
- [x] change file context (prompt/files)

IF everything passes in Windows AND defensive try catch... then enable
by default
- [x] enable auto-fix by default
2025-07-02 15:43:26 -07:00
Will Chen
64ae18b34b Make wait extra long for preview pick element (#488) 2025-06-24 22:22:23 -07:00
Will Chen
fe597db5b3 harden app files snapshot (#486) 2025-06-24 16:46:40 -07:00
Will Chen
87a0de438c fix select component test (#485) 2025-06-24 16:16:08 -07:00
Will Chen
47f3ec460a Add Capacitor support (#483)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-06-24 14:35:05 -07:00
Will Chen
9fbd7031d9 build ask mode (#444) 2025-06-19 10:42:51 -07:00
Will Chen
bd809a010d GitHub workflows (#428)
Fixes #348 
Fixes #274 
Fixes #149 

- Connect to existing repos
- Push to other branches on GitHub besides main
- Allows force push (with confirmation) dialog

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-06-17 16:59:26 -07:00
Will Chen
382fe9bab5 support setting for writing supabase migration files (#427) 2025-06-17 15:14:02 -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
67dc9f4c42 Print engine/gateway URL more clearly (#396) 2025-06-13 10:05:12 -07:00
Will Chen
b044acb61f Polish chat input UX (#388) 2025-06-11 14:39:55 -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
4907fcafd8 E2E test for fixing errors (#351) 2025-06-05 23:29:52 -07:00
Will Chen
d3fbb48472 Copy app (#349)
Fixes #12
2025-06-05 22:26:17 -07:00
Will Chen
16bf0828f5 Fix stale app UI (supabase) & overall E2E test infra improvements (#337)
Fixes #269
2025-06-04 23:07:59 -07:00
Will Chen
3558663ab7 Support native Git (experimental) (#338) 2025-06-04 21:37:05 -07:00
Will Chen
4e38031a65 Increase timeout for waiting for chat completion (#334) 2025-06-04 14:03:36 -07:00
Will Chen
e91a9c44fa Skip failing windows test (#332) 2025-06-04 10:31:13 -07:00
Will Chen
69b0e7aba2 Attempt to improve Windows E2E reliability(#331) 2025-06-04 07:42:00 -07:00
Will Chen
7994b01aa8 Context window e2e (#324) 2025-06-03 21:30:36 -07:00
Will Chen
b8f7490288 Stabilize E2E test by alphabetically sorting files for context (#321) 2025-06-03 17:58:59 -07:00
Will Chen
c227a08d11 Gateway e2e (#323) 2025-06-03 16:35:46 -07:00
Will Chen
fc1ebe9e8a e2e tests for engine (#322) 2025-06-03 16:11:16 -07:00