Commit Graph

100 Commits

Author SHA1 Message Date
Will Chen
40aeed1456 default to deep context (#1891)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Default Smart Files context to deep and align UI and stream handler
logic so any non-balanced option uses deep when Pro mode is enabled.
> 
> - **Smart Context behavior**
> - UI (`src/components/ProModeSelector.tsx`): default
`getCurrentValue()` to `"deep"` when Pro Smart Files mode is enabled
without an explicit option.
> - Engine (`src/ipc/handlers/chat_stream_handlers.ts`):
`isDeepContextEnabled` now requires `enableProSmartFilesContextMode` and
treats any option other than `"balanced"` as deep; `smartContextMode`
set accordingly and `versioned_files` used when deep.
> - **Snapshots**
> - Update e2e snapshots to reflect `smart_context_mode: "deep"` and new
`dyad_options.versioned_files` structure.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7426890467d60b671a7a9712f7544a35ed922981. 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
Default smart files context to deep and align the UI and stream handler
so anything not “balanced” uses deep when Pro Smart Files mode is on.
This prevents mismatches and makes deep context the default.

- **Bug Fixes**
  - ProModeSelector: default to deep when no option is set.
- chat_stream_handlers: isDeepContextEnabled requires Pro Smart Files
mode and treats non-“balanced” as deep; smartContextMode set to deep
accordingly.
  - Engine payload: use versioned_files; update e2e snapshots.

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

<!-- End of auto-generated description by cubic. -->
2025-12-04 22:13:49 -08:00
Will Chen
538745d546 Detect external changes with deep context (#1888)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds commit-aware deep context by computing hasExternalChanges (via
latest assistant commit vs current repo + dirty check) and propagating
commitHash through messages/provider options.
> 
> - **Deep Smart Context**:
> - Add `hasExternalChanges` to `VersionedFiles`; compute by comparing
latest assistant `commitHash` with `getCurrentCommitHash` and checking
`isGitStatusClean`.
> - Make `sourceCommitHash` nullable; add `commitHash` in
`DyadEngineProviderOptions` and use it when scanning history.
> - **Chat Handling**:
> - Include `commitHash` in `messageHistory` and pass through
`providerOptions['dyad-engine']`.
> - **Git Utilities**:
> - New `isGitStatusClean(path)` supporting native git and
isomorphic-git.
> - **Tests/Snapshots**:
> - Mock `getCurrentCommitHash` and `isGitStatusClean`; update snapshot
to include `hasExternalChanges`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ad92d9dd5ead941de822e8da59c8819e4db8b775. 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
Detects external code changes in deep context by comparing the latest
assistant commit with the current repo state. Exposes a
hasExternalChanges flag so the engine can adapt responses when the
workspace diverges.

- **New Features**
  - Added hasExternalChanges to VersionedFiles.
- Computes by comparing the latest assistant commitHash with
getCurrentCommitHash and checking isGitStatusClean.
- Passes commitHash through chat messages and dyad-engine
providerOptions; sourceCommitHash is now nullable.
  - Defaults to true if detection fails (with a warning).

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

<!-- End of auto-generated description by cubic. -->
2025-12-04 15:40:58 -08:00
Will Chen
3701886505 Fallback to balanced smart context for mentioned apps because not sup… (#1886)
…ported in deep context

Fixes https://github.com/dyad-sh/dyad/issues/1715

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Deep context now only applies with no app mentions; otherwise we
fallback to balanced and pass the effective mode to the engine, with
updated history limits and new e2e coverage.
> 
> - **Smart Context behavior**:
> - Deep mode activates only when no `@app:` mentions are present;
otherwise uses `balanced`.
> - Max chat turns set to 201 only for deep-without-mentions; otherwise
use configured limit.
> - **Engine integration**:
> - Send effective smart context mode via `dyadSmartContextMode` and map
to `dyad_options.smart_context_mode` in `llm_engine_provider`.
> - Add `SmartContextMode` schema (`balanced|conservative|deep`) and use
it in settings/types.
> - Remove static `smartContextMode` from engine options; use
per-request mode instead.
> - **Tests**:
> - Add e2e test `smart context deep - mention app should fallback to
balanced` with snapshot asserting `smart_context_mode: "balanced"` and
mentioned app files.
> - **Misc**:
>   - Tighten app path validation regex in `rename-app` handler.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5aada2bd246e297d7b35e36738f75c8531b897ae. 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
Fallback to balanced smart context when an app is mentioned in deep
mode, since deep doesn’t support mentioned apps. This keeps context
limits correct and updates engine config, with new e2e coverage.

- **Bug Fixes**
- Deep mode only applies when no apps are mentioned; otherwise we use
balanced.
- Max chat turns: 201 only for deep without mentions; otherwise use
configured limit.
- Plumb smart context mode via dyadSmartContextMode to the engine; add
SmartContextMode schema.
- Add e2e test to verify fallback in deep mode when an app is mentioned.

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

<!-- End of auto-generated description by cubic. -->
2025-12-04 15:19:37 -08:00
Mohamed Aziz Mejri
2a7f5a8909 feat: multi-component-selector (#1728)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds multi-component selection in the preview and sends all selected
components to chat for targeted edits. Updates overlays, UI, and IPC to
support arrays, smarter context focusing, and cross-platform path
normalization.

- **New Features**
- Select multiple components in the iframe; selection mode stays active
until you deactivate it.
- Show a scrollable list of selections with remove buttons and a Clear
all; remove from the list or click an overlay in the preview to
deselect. Sending clears all overlays.
- Separate hover vs selected overlays with labels on hover; overlays
persist after deactivation and re-position on layout changes/resizes.
- Chat input and streaming now send selectedComponents; server builds
per-component snippets and focuses their files in smart context.

- **Migration**
- Replace selectedComponentPreviewAtom with
selectedComponentsPreviewAtom (ComponentSelection[]).
- ChatStreamParams now uses selectedComponents; migrate any
single-selection usages.
  - previewIframeRefAtom added for clearing overlays from the parent.

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

<!-- End of auto-generated description by cubic. -->
2025-11-13 13:26:41 -08:00
Will Chen
06ad1a7546 Smart Context: deep (#1527)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Introduce a new "deep" Smart Context mode that supplies versioned
files (by commit) to the engine, adds code search rendering, stores
source commit hashes, improves search-replace recovery, and updates
UI/tests.
> 
> - **Smart Context (deep)**:
> - Replace `conservative` with `deep`; limit context to ~200 turns;
send `sourceCommitHash` per message.
> - Build and pass `versioned_files` (hash-id map + per-message file
refs) and `app_id` to engine.
> - **DB**:
>   - Add `messages.source_commit_hash` (+ migration/snapshot).
> - **Engine/Processing**:
> - Retry Turbo Edits v2: first re-read then fallback to `dyad-write` if
search-replace fails.
> - Include provider options and versioned files in requests; add
`getCurrentCommitHash`/`getFileAtCommit`.
> - **UI**:
>   - Pro mode selector: new `deep` option; tooltips polish.
> - Add `DyadCodeSearch` and `DyadCodeSearchResult` components; parser
supports new tags.
> - **Tests/E2E**:
> - New `smart_context_deep` e2e; update snapshots to include `app_id`
and deep mode; adjust Playwright timeout.
>   - Unit tests for versioned codebase context.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e3d3bffabb2bc6caf52103461f9d6f2d5ad39df8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-11-06 10:45:39 -08:00
Will Chen
369149b202 Security review: fix multiple issues (#1699)
See #1692

<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds multi-select with a "Fix X Issues" bulk action to Security Review
(severity-sorted, with animated header button), clears selections on
refresh, and improves streaming error logs; includes e2e coverage.
> 
> - **Security Review UI
(`src/components/preview_panel/SecurityPanel.tsx`)**:
>   - **Multi-select & Bulk Fix**:
> - Add per-row checkboxes and a "Select all" checkbox in
`FindingsTable`; sort by severity; ARIA labels.
> - Track `selectedFindings`; clear on new data; header shows animated
"Fix X Issues" button (`Wrench` icon) that creates one chat with a
combined prompt for selected issues.
> - **Fix Single Issue**: Preserve existing per-row "Fix Issue" flow
with loading states.
> - **Tests**:
> - Add e2e test `security review - multi-select and fix issues` and
snapshots for selection table and combined prompt.
> - **IPC (`src/ipc/ipc_client.ts`)**:
> - Enhance error logging (`console.error`) in `streamMessage` paths;
simplify `cancelChatStream` (remove stale cleanup).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
08b9f92814e2a676d0a8de1badf7dc79cd82a14a. 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
Add multi-select to the Security Review so you can select issues and fix
them in one go. Improves error handling in chat streaming and adds an
e2e test for the new flow.

- New Features
- Checkboxes per finding and a “Select all” checkbox, with
severity-sorted rows.
- Header shows an animated “Fix X Issues” button when items are
selected; creates one chat with a combined prompt; clears selection
after.
  - New e2e test: multi-select and bulk fix.

- Bug Fixes
  - Clear selections when new review results load.
- Better error logging in IpcClient for streaming failures; simplify
cancelChatStream to avoid false errors.

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

<!-- End of auto-generated description by cubic. -->
2025-11-03 19:58:26 -08:00
Will Chen
04b1a36f4a Deep link: add prompt (#1669)
Example:
open
"dyad://add-prompt?data=eyJ0aXRsZSI6IlRlc3QgUHJvbXB0IiwiZGVzY3JpcHRpb24iOiJBIHRlc3QgcHJvbXB0IGZyb20gZGVlcCBsaW5rIiwiY29udGVudCI6IlRoaXMgaXMgdGhlIGNvbnRlbnQgb2YgdGhlIHByb21wdC4ifQ%3D%3D"

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds dyad://add-prompt deep link that navigates to Library and opens a
prefilled Create Prompt dialog from base64 JSON.
> 
> - **Deep Link Handling**
> - Parse `dyad://add-prompt?data=<base64-json>` in `src/main.ts`;
validate with `AddPromptDataSchema` and send `deep-link-received` with
payload.
> - Extend `DeepLinkContext` to navigate to `/library` on `add-prompt`.
> - **Library/Dialogs**
> - Add controlled open state and `prefillData` support to
`CreateOrEditPromptDialog` and `CreatePromptDialog`
(`src/components/CreatePromptDialog.tsx`).
> - In `src/pages/library.tsx`, listen for `add-prompt` deep link,
prefill form, open dialog, and clear deep-link state.
> - **Schemas**
> - Define `AddPromptDataSchema`, `AddPromptPayload`, and
`AddPromptDeepLinkData` in `src/ipc/deep_link_data.ts` and include in
`DeepLinkData` union.
> - **E2E Tests**
> - Add Playwright test `e2e-tests/add_prompt_deep_link.spec.ts` and
ARIA snapshot to verify deep link opens prefilled dialog and saves
prompt.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
1ddb12306cfca195682c8a1b719f60093b858d54. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-29 21:26:01 -07:00
Will Chen
8c03b7752d rebaseline security review e2e test (#1670)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is
generating a summary for commit
abe012e8d2a7c072dfa3c7632f80611e7b77fdd8. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-29 21:01:54 -07:00
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
Mohamed Aziz Mejri
a3997512d2 Feat : allow referencing files (#1648)
I implemented file referencing feature mentioned in issue #1591 

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds support for referencing app files in chat using @file:<path>. The
input now autocompletes files, and the backend validates and surfaces
referenced files in the chat context as read-only.

- **New Features**
  - Chat input autocompletes @ mentions for apps, prompts, and files.
- Recognizes @file:<path> and converts it to a structured mention on
submit.
- Backend parses @file mentions, checks file existence, and adds a
“Referenced Files” section to the system message.
- New get-app-files IPC handler and useAppFiles hook to load file paths
for the selected app (appFilesAtom added).
  - e2e test for mentioning a file and capturing server dump.

<!-- End of auto-generated description by cubic. -->
2025-10-29 09:43:19 -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
Will Chen
7bed92f782 Allow selecting problems (#1568)
Fixes #672 


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Add selectable problem rows with Select all/Clear all and Fix N
selected, and update tests to cover selection behavior.
> 
> - **UI (Problems panel)**:
> - Add checkbox selection for each problem row (`ProblemItem`) with row
click-to-toggle, `data-testid="problem-row"`, and accessibility
attributes.
> - Introduce selection state in `_Problems` with auto-select-all on
report load; provide Select all / Clear all controls.
> - Change Fix button to operate on selected problems only, showing
dynamic label `Fix N problem(s)` and disabled when none selected.
> - Wire `RecheckButton` to clear selection before rechecking; minor
hover style tweaks; add `Checkbox` component.
> - **E2E Tests**:
> - New test: selecting specific problems and fixing only selected; add
snapshots for prompt content.
> - Update manual edit tests (React/Vite, Next.js) to assert Fix button
enabled/disabled and counts; remove old ARIA snapshots.
>   - Minor import addition for `Timeout` and related expectations.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8324e26f9d2d265e7e0d1f1b7538e2a8db40f674. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-23 10:18:55 -07:00
Will Chen
133ca57628 Support Supabase branches (#1394)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Adds Supabase database branch selection per app, with a new schema field
and UI to choose a branch after connecting a project. Resets branch when
changing or disconnecting the project to keep state consistent.

- **New Features**
  - Added apps.supabase_branch_id column.
- Branch dropdown in SupabaseConnector shown after a project is
connected; selection persists and triggers app refresh.
- New state and hooks: supabaseBranchesAtom, loadBranches(projectId),
setAppBranch(branchId).
- IPC endpoints: supabase:list-branches and supabase:set-app-branch;
setting/unsetting project also clears the branch.

- **Migration**
- Apply drizzle migration 0013_supabase_branch.sql to add the
supabase_branch_id column (defaults to null).

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

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds Supabase database branch selection per app, including parent
project tracking, new IPC endpoints, UI dropdown, and an accompanying DB
migration with e2e tests.
> 
> - **Database**:
> - Add `apps.supabase_parent_project_id` via migration
`drizzle/0015_complete_old_lace.sql`; snapshot and journal updated.
> - **IPC/Main**:
> - New `supabase:list-branches` handler and management client
`listSupabaseBranches` (real API + test stubs).
> - Update `supabase:set-app-project` to accept `{ projectId,
parentProjectId?, appId }`; unset clears both IDs.
> - `get-app` resolves `supabaseProjectName` using
`supabase_parent_project_id` when present.
> - **Types & Client**:
> - Add `SupabaseBranch`, `SetSupabaseAppProjectParams`, and
`App.supabaseParentProjectId`; expose `listSupabaseBranches` and updated
`setSupabaseAppProject` in `ipc_client` and preload whitelist.
> - **UI/Hooks**:
> - Supabase UI: branch dropdown in `SupabaseConnector` with
`loadBranches`, selection persists via updated `setAppProject`.
> - State: add `supabaseBranchesAtom`; `useSupabase` gets `branches`,
`loadBranches`, new param shape for `setAppProject`.
>   - TokenBar/ChatInput: add `data-testid` for token bar and toggle.
> - **Supabase Context (tests)**:
> - Test build returns large context for `test-branch-project-id` to
validate branch selection.
> - **E2E Tests**:
> - Add `supabase_branch.spec.ts` and snapshot verifying branch
selection affects token usage.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
33054278db8396b4371ed6e8224105cb5684b7ac. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-14 15:34:42 -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
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
75b4b7c299 Handle mentioned apps via smart context (#1412)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Send mentioned apps (names + files) to the engine through
dyad_options, omit inline other-apps prefix when engine is enabled, and
adjust e2e to snapshot request payload.
> 
> - **Engine/Backend**:
> - Pass mentioned apps to engine via
`providerOptions['dyad-engine'].dyadMentionedApps` and forward as
`dyad_options.mentioned_apps` in `llm_engine_provider`.
> - Gate inline other-apps context: only include `otherCodebasePrefix`
when `isEngineEnabled` is false.
> - Enhance `extractMentionedAppsCodebases` to return `files` alongside
`codebaseInfo`.
> - **Tests**:
> - e2e: change `mention app (with pro)` snapshot to
`snapshotServerDump("request")` and update snapshot to assert request
payload contents.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7ddddf6c16c53cd36b4c7e4ec6a57da0616d1bb0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-09-30 17:05:18 -07:00
Will Chen
39266416c7 Add GPT 5 Codex and Sonnet 4.5 (#1398)
Fixes #1405 
    
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Adds GPT-5 Codex (OpenAI and Azure) and Claude 4.5 Sonnet to the model
options to enable newer coding models and larger contexts. Also
increases Claude 4 Sonnet max output tokens to 32k.

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


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds GPT‑5 Codex (OpenAI/Azure) and Claude 4.5 Sonnet, and increases
Claude 4 Sonnet max output tokens to 32k across providers and tests.
> 
> - **Models**:
>   - **OpenAI**: add `gpt-5-codex` (400k context, default temp 1).
>   - **Anthropic**:
> - add `claude-sonnet-4-5-20250929` (1M context, `maxOutputTokens:
32_000`).
> - update `claude-sonnet-4-20250514` `maxOutputTokens` from `16_000` to
`32_000`.
> - **Azure**: add `gpt-5-codex` (400k context, `maxOutputTokens:
128_000`).
>   - **Bedrock**:
> - add `us.anthropic.claude-sonnet-4-5-20250929-v1:0` (1M context,
`maxOutputTokens: 32_000`).
> - update `us.anthropic.claude-sonnet-4-20250514-v1:0`
`maxOutputTokens` to `32_000`.
> - **E2E tests**:
> - Update snapshots to reflect `max_tokens` increased to `32000` for
`anthropic/claude-sonnet-4-20250514` in engine and gateway tests.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
73298d2da0c833468f957bb436f1e33400307483. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-09-30 13:46:44 -07:00
Will Chen
9cca1d2af0 Fix MCP & title bar (#1348)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Fixes MCP handoff by detecting an edit-code tool call and stopping
generation. Simplifies the title bar credit tooltip; also blocks dyad-*
tags in the system prompt and updates tests.

- **Bug Fixes**
- Stop generation on edit-code via hasToolCall; add a no-op edit-code
tool to signal handoff.
  - Combine tool-call stop with existing step limit for reliability.
  - Forbid <dyad-*> tags in the system prompt to prevent misuse.
- Remove credit usage/reset details from the title bar tooltip; keep the
delay note.
  - Update e2e snapshot to reflect the new prompt rule.

<!-- End of auto-generated description by cubic. -->
2025-09-22 15:50:18 -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
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