Fix attachment upload instructions for local agent mode (#2412)
Fixes #2395
## Summary
- Use `write_file` tool format instead of `dyad-write` XML tags when
local agent stream mode is active
- The local agent uses tools rather than XML-based commands, so
attachments need compatible upload instructions
- Refactored `willUseLocalAgentStream` check to be computed once and
reused
## Test plan
- Test uploading file attachments while in local agent mode
- Verify the system prompt contains `write_file` tool instructions
instead of `dyad-write` XML tags
- Verify regular (non-local-agent) mode still uses the XML-based
instructions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2412">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<!-- devin-review-badge-end -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: only adjusts system-prompt attachment upload instructions
and reuses a single `willUseLocalAgentStream` flag; could affect how
models handle uploads in local-agent/Pro ask mode.
>
> **Overview**
> Fixes attachment-upload prompting when streaming via the local agent
by switching from `dyad-write` XML tag instructions to `write_file`
tool-call instructions for conversations that will use
`handleLocalAgentStream`.
>
> Also refactors the `willUseLocalAgentStream` condition to be computed
once (based on chat mode/Pro ask mode and absence of mentioned-app
codebases) and reused for both system-prompt construction and
`aiMessagesJson` persistence.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
60dd66e4548c5d10ace43739aea7765958284739. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by:
Claude Opus 4.5 <noreply@anthropic.com>
正在显示
请
注册
或者
登录
后发表评论