Commit 84c5a95
feat(decopilot): add user_ask built-in tool (#2419)
* feat(decopilot): add user_ask built-in tool
- Add user_ask tool for gathering user input during task execution
- Support text, choice, and confirm input types
- Integrate built-in tools into decopilot stream endpoint
- Simplify base prompt for decopilot
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(storage): upsert thread messages for user_ask resolution
- Add ON CONFLICT upsert for thread messages (PostgreSQL)
- Merge config messages with thread history by id for tool result updates
- Deduplicate messages by id before batch insert
- Add conversation and threads tests
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(chat): add user_ask UI and integration
- Add ChatHighlight with UserAskQuestionHighlight for user_ask prompts
- Add UserAskQuestionPart for inline placeholder in assistant messages
- Support text, choice, and confirm input types with forms
- Wire user_ask into chat context, input, and thread cache
- Add UserAskToolPart type for tool-user_ask parts
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: add user_ask built-in tool API reference
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: add implementation plan for cache/db inconsistency fix
Create comprehensive plan to fix critical cache consistency issues:
- Add error propagation and user notifications
- Implement save status tracking endpoint
- Add client-side save status polling
- Remove immediate cache updates
- Reduce stale time from 30s to 5s
- Document message transformation contract
- Add E2E test stubs
Fixes: main-99k
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* docs: remove test writing from cache/db fix plan
Remove all test writing and test running steps for faster implementation:
- Remove error type tests
- Remove save status endpoint tests
- Remove useSaveStatus hook tests
- Remove E2E test task entirely
- Keep only implementation, type check, format, and commit steps
- Update task numbering (7 tasks instead of 9)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(decopilot): enhance conversation processing and model compatibility
- Introduced a message ID generator for unique message identification.
- Updated DECOPILOT_BASE_PROMPT to return a structured ChatMessage.
- Refactored processConversation to accept a memory object and handle message processing more efficiently.
- Added ensureModelCompatibility function to validate message compatibility with model capabilities.
- Improved error handling for message processing and ensured only one non-system message is present.
- Added new model-compat.ts file for extensible model compatibility checks.
This update enhances the overall robustness and maintainability of the Decopilot conversation handling.
* refactor(chat): extract UserAskQuestionPart into dedicated component and fix types
Move the inline UserAskQuestionPart from user-ask-question.tsx into its own
file under parts/, handling output-available, output-error, and output-denied
states. Update MessageAssistant and MessagePair to use the ChatMessage type
for proper UITools type narrowing, removing the need for unsafe casts.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(chat): unify user-ask form with combined schema and improved UX
Replace per-question forms with a single unified react-hook-form instance
backed by a combined Zod schema. For multiple questions, show a tabbed
layout with check-circle progress indicators and a "Next" / "Submit all"
button flow. Simplify the highlight component props (disabled boolean
instead of status) and clean up unused schema exports.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(decopilot): consolidate Memory interface into exported class
Remove the separate Memory interface from types.ts and rename the
private ThreadMemory class to Memory, exporting it directly from
memory.ts. Moves MemoryConfig to memory.ts as well. This eliminates
an unnecessary abstraction layer since there was only ever one
implementation.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(decopilot): use consistent DEFAULT_THREAD_TITLE for title generation
Extract "New chat" as DEFAULT_THREAD_TITLE constant and use it both
in thread creation and to determine whether title generation should
run. Previously the title check relied on message count which could
skip generation on conversation resumption.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(decopilot): add windowSize to Memory.loadHistory with user-role trimming
- Add optional windowSize param to loadHistory(); fetch latest N messages via sort desc
- Extend listMessages with sort option (asc|desc) in storage port and implementation
- Trim window to start with user role; return [] if no user message in window
- Remove redundant getPrunedHistory()
- Update conversation tests with mockListMessages for desc sort
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore(decopilot): remove unused ensureUser export
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(decopilot): align user_ask tests with current description
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(decopilot): simplify user_ask tool description and schema
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(decopilot): update types, schemas, model provider and routes
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(chat): update chat components and MCP config form
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(chat): fix last message pair layout for bottom visibility
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: add user-ask tool and tool output deduplication plans
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(decopilot): simplify title generation with promise-based API
Replace callback-based onTitle pattern with a direct Promise<string | null>
return value, making the control flow easier to follow.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(decopilot): preserve assistant/tool context when no user message in window
When the history window contains no user message, return the full windowed
messages instead of an empty array so that assistant and tool context is
retained for follow-up turns.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(decopilot): split system/request messages at validation boundary
Extract splitRequestMessages() to separate system messages from the single
request message during request validation, simplifying processConversation
by removing internal message splitting and the instruction parameter. Also
adopts the promise-based title generation in the streaming route.
Co-authored-by: Cursor <cursoragent@cursor.com>
* update design
* refactor(ui): use Tailwind shrink-0 in page header
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(chat): improve user_ask UI - remove disabled state, add skip, use isStreaming for loading
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore: remove refs/chatbot-tool-usage.md and docs/plans/
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(decopilot): ensure unique timestamps for request/response message pairs
Use incrementing millisecond offsets when saving request and response
messages to avoid identical createdAt/updatedAt timestamps, which could
cause ordering ambiguity or deduplication issues downstream.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(chat): remove copy-on-click behavior from user messages
Remove unused extractTextFromMessage helper and useCopy hook usage,
simplifying the click handler to only focus and scroll to the pair.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(chat): hide user-ask prompt when no pending parts
Return null early when pendingParts is empty to avoid rendering
an empty prompt container.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: rafavalls <valls@deco.cx>1 parent 9a21022 commit 84c5a95
50 files changed
Lines changed: 2972 additions & 729 deletions
File tree
- apps
- docs/client/src/content/en/api-reference/built-in-tools
- mesh/src
- api/routes/decopilot
- built-in-tools
- storage
- web
- assets
- components
- chat
- highlight
- message
- parts
- thread
- tiptap
- details/connection/settings-tab
- page
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 398 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
0 commit comments