Commit Graph

82 Commits

Author SHA1 Message Date
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
56d0e76790 Make balanced smart context option the default (#1186)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Set “balanced” as the default smart context mode. Users now get balanced
when Smart Files Context is enabled and no mode is set; “conservative”
must be explicitly selected.

- **Refactors**
- Default fallback to balanced in UI and engine (proSmartContextOption
undefined -> "balanced").
- ProModeSelector saves "conservative" explicitly; selector reads
undefined as balanced.
  - Updated schema and types to allow "balanced" | "conservative".
- Engine payload now includes smart_context_mode with "balanced" by
default; e2e tests and snapshots updated.

- **Migration**
- No action needed. Existing users without an explicit mode will use
balanced by default; selecting conservative persists.

<!-- End of auto-generated description by cubic. -->
2025-09-04 11:06:46 -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
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
53bbfc9813 Read JSON (#1081)
Fixes #1037 
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Enable JSON file support in codebase scanning so common configs and data
(e.g., package.json, vercel.json, translations) are included. Adds .json
to the allowed extensions and removes special-casing for
package.json/vercel.json.

<!-- End of auto-generated description by cubic. -->
2025-08-26 09:57:19 -07:00
Will Chen
1dfa0d1004 Fix package.json (#1080)
Fixes #554 #1049 
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Stop mutating package.json when reading files. readFileWithCache now
returns raw content so all fields are preserved (e.g., packageManager).
Fixes #554 and #1049.

- **Bug Fixes**
  - Removed package.json "cleaning" logic and the cleanContent helper.
- Return and cache unmodified file content from both fs and
virtualFileSystem.

<!-- End of auto-generated description by cubic. -->
2025-08-25 21:11:27 -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
d535db6251 Upgrade to AI sdk with codemod (#1000) 2025-08-18 22:21:27 -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
Olyno
237017acd9 feat: allow custom install and start commands (#892)
# Description

Gives the ability to define an `install` and `startup` command when
importing a project, so we can work on a project locally without any
issue.

# Preview

<img width="2256" height="1422" alt="image"
src="https://github.com/user-attachments/assets/2132b1cb-5f71-4b88-84db-8ecc81cf1f66"
/>

---------

Co-authored-by: Will Chen <willchen90@gmail.com>
2025-08-18 10:41:22 -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
c6eb3975f3 Rebase GPT 4.1 engine (#909) 2025-08-11 15:53:31 -07:00
Will Chen
5db0b04400 Support exclude paths in manual context management (#774) 2025-08-05 14:33:39 -07:00
Will Chen
42cbb59b69 Remove shadcn from exclude list for smartcontext (#769) 2025-08-04 17:22:25 -07:00
Will Chen
e5e1495c57 Add vercel.json for default React vite.js template (#755)
Fixes #741 
See: https://vercel.com/docs/project-configuration#rewrites-examples
2025-07-31 15:17:47 -07:00
Will Chen
7938b69eca Exclude .next & include .gitignore (#757) 2025-07-31 14:25:21 -07:00
Will Chen
14f13c7c92 Improve system prompt to avoid laziness (#751)
Fixes #749
2025-07-31 12:56:38 -07:00
Will Chen
510d288d78 Show code snippet in fix problems (#745) 2025-07-30 16:03:17 -07:00
Will Chen
e947eede7a community templates (#691) 2025-07-23 10:11:16 -07:00
Will Chen
9edd0fa80f Upload image via chat (#686) 2025-07-22 15:45:30 -07:00
Will Chen
de73445766 Update codebase.ts so that all files are read (#684) 2025-07-21 21:16:00 -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
2c284d0f20 Allow configuring environmental variables in panel (#626)
- [ ] Add test cases
2025-07-11 10:52:52 -07:00
Will Chen
5f3dea6180 Make capacitor tests version-resilient (#624) 2025-07-10 14:37:46 -07:00
Will Chen
a1aee5c2b8 Graduate file editing from experimental (#599) 2025-07-08 11:39:46 -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
8260aa86e2 Rebaseline goldens (#559) 2025-07-03 11:38:59 -07:00
Will Chen
08a386750d rebaseline next.js (#548) 2025-07-02 16:50:31 -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
2ea9500f73 Configurable thinking budget (default to medium) (#494) 2025-06-25 15:36:05 -07:00
Will Chen
52aebae903 Fix order of dyad tag processing (#495)
Fixes #493
2025-06-25 15:34:11 -07:00
Will Chen
08ab7c1c37 Support astro & other common FE file extensions (#489)
Closes #462
2025-06-24 22:23:20 -07:00
Will Chen
fe597db5b3 harden app files snapshot (#486) 2025-06-24 16:46:40 -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
2463e977b5 Deflake select component e2e test baselines (#482) 2025-06-24 12:50:02 -07:00
Will Chen
5d678c2ead Smart auto (#476) 2025-06-23 23:08:29 -07:00
Will Chen
3041563809 Finish incomplete dyad write (#475)
Fixes #452 
Fixes #456 
Fixes #195
2025-06-23 22:53:55 -07:00
Will Chen
fa29488b98 Update system prompt to make build mode more assertive about making c… (#473)
…ode changes

Fixes #457
2025-06-23 16:04:40 -07:00
Will Chen
9fbd7031d9 build ask mode (#444) 2025-06-19 10:42:51 -07:00
Will Chen
8464609ba8 Fix parsing dyad tags with nested tags: < > (#445)
Fixes #441
2025-06-19 10:08:26 -07:00
Will Chen
897d2e522c enable engine for all models (#434) 2025-06-18 17:17:29 -07:00
Will Chen
e326f14779 Revert "Revert "Update gemini 2.5 models to GA variants (#425)" (#429)" (#437)
This reverts commit ff4e93d747.
2025-06-18 17:11:17 -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
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