Commit Graph

248 Commits

Author SHA1 Message Date
MagMueller 51598efd56 Trim HistoryItem freeze change tests 2026-05-23 12:20:55 -07:00
Saurav Panda 8236cc7506 agent(history): freeze HistoryItem + lock byte-prefix property in tests
For Gemini's implicit cache (and similar provider caches) to actually
hit step over step, the rendered transcript for steps 1..N-1 must be
byte-identical at step N and at step N+1. The agent already appends
HistoryItems immutably in practice, but nothing in the type prevented
a future caller from mutating one in place — which would silently kill
the cache from that byte onward.

Mark HistoryItem frozen so any mutation now fails loud at runtime
rather than slowly burning input tokens. Add a regression test set
that asserts the cache property directly:

- render(items[:N]) must be a strict byte-prefix of render(items[:N+1])
- to_string() is deterministic for identical inputs
- the prefix property holds across mixed entry shapes (normal steps,
  errors, system messages, follow-up tasks)
- conditional field inclusion doesn't collapse to ambiguous output

Known limitation, not addressed here: max_history_items compaction in
MessageManager.agent_history_description rewrites earlier bytes once
the cap is exceeded (the omitted-count message changes). That's a
larger redesign and deserves its own PR.
2026-05-22 17:55:43 -07:00
Laith Weinberger 65f87b7fca fix sensitive_data redaction order to prevent substring leaks 2026-04-11 18:16:24 -04:00
Saurav Panda 02349f1d9c fix: prevent compaction hallucination 2026-03-17 15:39:35 -07:00
Saurav Panda 2895720eb0 fix: remove unused variable assignments 2026-03-07 14:37:31 -08:00
Cursor Agent 270e418cea feat(agent): expose max_clickable_elements_length as Agent parameter
- Add max_clickable_elements_length parameter to Agent.__init__ with default 40000
- Add max_clickable_elements_length to AgentSettings
- Pass parameter through MessageManager to AgentMessagePrompt
- Bump version to 0.11.10a2

Co-authored-by: Magnus Müller <MagMueller@users.noreply.github.com>
2026-02-17 02:07:09 +00:00
ashish-cheruku ab83ee7a8a fix: improve sensitive_data placeholder instructions for LLM clarity
Fixes #3970

The LLM was typing literal placeholder names (e.g., 'user_name') instead
of wrapping them in <secret> tags (e.g., '<secret>user_name</secret>').

Changes to _get_sensitive_data_description():
- Added clear 'SENSITIVE DATA' header to draw attention
- Changed placeholder list format from Python list to bullet points
- Added explicit 'MUST' instruction emphasizing the required format
- Added concrete example using the first actual placeholder name
- Added explanation that the system will replace tags with actual values

This makes it much clearer to the LLM that it needs to wrap placeholder
names in <secret> tags for the automatic replacement mechanism to work.
2026-02-06 18:10:14 +05:30
Saurav Panda 6b9910a546 changed the threshold for compaction 2026-02-05 16:41:08 -08:00
Saurav Panda 79501fe2cd added message compaction for agent 2026-02-05 12:26:11 -08:00
Saurav Panda 5ad365e31b added basic planing to agents 2026-02-02 12:28:29 -08:00
Cursor Agent 8ba95aefa8 Fix: Filter sensitive data from state messages
This change ensures that sensitive data in action results is filtered before being included in state messages sent to the LLM. This prevents accidental leakage of private information. New tests are added to verify this functionality.

Co-authored-by: mailmertunsal <mailmertunsal@gmail.com>
2025-12-11 00:00:37 +00:00
Gregor Žunič b1e4d6e686 primitive skills impl (with cookies) 2025-12-08 18:07:00 -08:00
Mert Unsal 02cf38e864 Revert "allowing MUCH MORE with coordinates" 2025-11-28 04:00:22 -08:00
mertunsall 46cb1a0ae1 allowing MUCH MORE with coordinates 2025-11-27 14:48:23 -08:00
mertunsall d06d8fa8a2 image resizing the make sonnet 4.5 work 2025-11-07 22:20:14 -08:00
mertunsall d3a88ce351 vision defaults to True 2025-11-06 16:29:09 -08:00
skools-here f8686f4012 Fix: display Chinese characters correctly in conversation logs by using ensure_ascii=False 2025-11-04 19:49:27 +05:30
mertunsall 03c9e94dc6 allow reading images such as jpg/png, as well as docx, fixes to the flash system prompt 2025-11-03 16:41:27 -08:00
Magnus Müller 75b4fe58ba Result:\n to Result\n because :\ would be the token 2025-10-12 13:08:14 -07:00
Magnus Müller d1d313f0f4 Remove </step> - 3 tokens x number of steps taken 2025-10-12 13:08:05 -07:00
mertunsall 7632a9f56f store state message in the history 2025-10-08 16:49:50 +02:00
Magnus Müller b53a7c116a Update outdated function names 2025-10-05 19:12:52 -07:00
Magnus Müller d014474998 Linter 2025-10-04 12:59:11 -07:00
Magnus Müller d3abbcb2c7 Include use_vision auto 2025-10-04 12:56:40 -07:00
Magnus Müller 461bce7b22 Request screenshot 2025-10-03 23:55:15 -07:00
Magnus Müller a5cc03d782 Add character limit enforcement for read_state_description and action_results 2025-09-22 16:10:05 -07:00
Saurav Panda 126d800df4 remove sensitive data from agent history and logging 2025-09-16 14:41:24 -07:00
Magnus Müller b92dd506f9 Rename to follow up request 2025-09-07 18:48:12 -07:00
Magnus Müller b074521084 Fix task update in MessageManager to correctly use new user request format 2025-09-07 18:40:46 -07:00
Magnus Müller 71c848c8ef fix followup tasks 2025-09-07 18:15:12 -07:00
zhcn a99971f39c Merge branch 'main' into feature/sample_images 2025-09-02 18:51:03 +08:00
zhcn 963ec67472 Update code style 2025-09-02 13:07:43 +08:00
zhcn 0fc797b9f6 Update sample_images type 2025-09-02 13:01:41 +08:00
zhcn ea74a986ac Update 2025-09-02 12:39:31 +08:00
zhcn f68c0865f7 Add sample_images to enable browseruse to learn how to operate a platform. 2025-09-02 12:33:04 +08:00
Magnus Müller c3d0c800a2 Refactor agent prompts for clarity and consistency
- Updated page info text format to enhance readability and structure.
- Changed date format in agent state description to display only the current date.
- Simplified action results formatting in message manager for better clarity.
- Adjusted history item string representation to streamline output and remove unnecessary prefixes.
2025-08-31 19:20:45 -07:00
Magnus Müller 1a31aefd38 Merge remote-tracking branch 'origin/main' into fix-tab-switching 2025-08-29 14:48:46 -07:00
Magnus Müller 84cdd34743 Return the agent the result from init actions 2025-08-29 12:33:51 -07:00
Saurav Panda 4bfaa266b3 explicit check for sensitive data field 2025-08-27 16:38:30 -07:00
Saurav Panda 6a8dc3b8e2 fix: Add sensitive data placeholder names to LLM prompts 2025-08-27 15:54:18 -07:00
Nick Sweeting 76512fbfdd fix Failed to build DOM tree: cannot reuse already awaited coroutine 2025-08-16 17:58:45 -07:00
mertunsall d243ae7bcb make sure that read state can handle multiple items nicely 2025-08-14 20:45:02 +01:00
Nick Sweeting 31fb754473 finish connecting feature flags 2025-08-08 20:23:18 -07:00
mertunsall 6a15ed4c4e cleaner 2025-08-05 15:21:52 +01:00
mertunsall 10581b6e77 just improve more 2025-08-05 15:10:23 +01:00
mertunsall bc9a3a5fbb just improve 2025-08-05 15:07:50 +01:00
mertunsall a6ac62ff5e format 2025-08-05 13:45:53 +01:00
Mert Unsal 714b5f7d0b Merge branch 'main' into mert/improve_messages_for_kv_cache 2025-08-05 13:32:59 +01:00
Cursor Agent 48165d21e6 Remove message_context parameter from agent and message manager
Co-authored-by: mailmertunsal <mailmertunsal@gmail.com>
2025-08-03 14:00:19 +00:00
mertunsall 9bd0036223 separate agent history and state 2025-08-02 15:48:49 +01:00