Skip to content

Commit 3e60e38

Browse files
Rewrite Agent Loop (browseros-ai#7)
* clean-up bunch of files for re-write * more clean-up and adding basic agent * Minor fix moved types into respective files. * Deleted bunch of old files backup Update gitignore Deleted a bunch of files Remove message manager Deleted old docs Update rules rename Profiler to profiler * Temporarily adding old code * Adding two small things back * backup * Implemented LangChainProvider and updated cursor rules backup LangChainProvider curosr rules * Implement tests for LangChainProvider -- unit test and integration test integration test passes integration test backup * Tool Design Tools Desing tools design * NavigationTool ready NavigationTool ready NavigationTool ready NaivgationTool ready backup * MessageManager MessageManager backup * Fixed integration test * Agent design new Updated agent design and added bunch of /NTN commands agent new design * Delete old agent design * MessageManagerReadOnly class * PlannerTool ready PlannerTool almost ready * ToolManager and DoneTool * Integration of BrowserAgent * BrowserAgent implementation v0.1 * BrowserAgent small fix v0.2 * Tool calling design too call design tool design claude * Update agent tool design with // NTN * add zod-to-json npm install * BrowserAGent v0.3 * BrowserAgent v0.4 * BrowserAgent v0.5 * fixes * Build error fixes in my NEWLY added code build errors fix * Build error fixes in old code (integration work) backup * Comment StreamEventProcessor for now, it is not used * Small build error fix * Small rename * Added integration test to check structuredLLM and changed to 4o-mini change default to nxtscape integration test * Small docstring * Simplified BrowserAgent code and added integration test Simplified BrowserAgent code BrowserAGent integrationt est * Update CLAUDE.md with project memory and instructions on how to write code Update CLAUDE.md with project memory and instructions on how to write code Project Memory * Just a mova.. Moved ToolManager outside. Build works. * TabOperations tool TabOperations Tool and fixing some test tab operations * Update CLAUDE.md * Added ClassificationTool classifiction tool classification prommpt * Refactored and simplified PlannerTool unit test and integration test * Updated Plnnaer tool * Update CLAUDE.md * BrowserAgent modified to do classification BrowserAgent with classification * minor fix to ToolManager * Instead of ToolCall and ToolResult -- just updating message manager once * minor fix to BrowserAgent integration test * Changed done to "done_tool" * Updated CLAUDE.md to reflect understanding of claude * Uncommented stream event processor * Renamed EventBus to StreamEventBus * Commented StreamEventProcessor * Event Processor * Integrated EventProcessor with BrowserAgent Added EventProcessor to BrowserAgetn * Renamed StreamEventBus to EventBus * Made EventBus required parameter in ExecutionContext * PlanGenerator rewrite PlanGenerator rewrite backup * For simple task, explicitly tell it to call done tool * Max attempts for simple task * backup * Revert "backup" This reverts commit 7d79a3d4d5774bfef79ec9827878b74edad3593f. * Consolidating where EventBus and EventProcessor are created and initialized backup * Update CLAUDE.md Update CLAUDE.md * Improving agent loop code Cleaned up processTooCall classification task * Create test-writer subAgent test-agent-prompt test agent prompt test-agent-prompt Update test-writer.md * BrowserAgent test Browseragent test BrowserAgent test * BrowserAgent refactor backup backup * Minor fixes * Minor fix * minor change -- NEW AGENT LOOP IS WORKING WELL * Update cursor rules * Small change * Improved BrowserAgent integration test Improved BrowserAgent integration test * Small change * Update CLAUDE.md * Different tools * FindElementTool is ready Find element update backup find element backup * Updated to test strings to say "tests..." * ScrollTool is ready * RefreshStateTool is updated as well * MessageManager updated * SearchTool is ready backup * Interaction Element is also ready * Add debugMessage emitter * ValidatorTool ready and tests are passing Validation Tool validator tool backup backup * GroupTabs tool ready * Registered all the tools * Planning changed to 5 steps * BrowserAgent integration test fix * Minor string changes * backup * Removed too many confusing events in EventProcessor -- there is only event.info right now * Abort control implemented backup Abort * Formatter for toolResult Formatter for toolResult backup * Always render using Markdown * Minor fix --------- Co-authored-by: Nikhil Sonti <nikhilsv92@gmail.com>
1 parent 4109ad0 commit 3e60e38

File tree

189 files changed

+16896
-5093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+16896
-5093
lines changed

.claude/agents/test-writer.md

Lines changed: 517 additions & 0 deletions
Large diffs are not rendered by default.

.cursor/rules/cursorrules.mdc

Lines changed: 433 additions & 71 deletions
Large diffs are not rendered by default.

.cursorrules

Lines changed: 433 additions & 66 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
reference_code/*
2-
31
# Dependencies
42
node_modules/
53
bak/

.windsurfrules

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ alwaysApply: true
77
- DO NOT automatically create or updateREADME.md file for changes.
88
- DO NOT automatically generate example file to use the code unless asked.
99
- DO NOT automatically generate tests for the code unless asked.
10+
- IMPORTANT: Never use optional defaults like `|| "default-value"` in code. Always define constants at the top of the file for any default values (e.g., `const DEFAULT_MODEL = "gpt-4o-mini"`)
1011

1112
# Code Style & Formatting
1213
- Use English for all code and documentation.
@@ -21,13 +22,18 @@ alwaysApply: true
2122
- Favor loops and small helper modules over duplicate code.
2223
- Use descriptive names with auxiliary verbs (e.g. isLoading, hasError).
2324
- File layout: exported component → subcomponents → hooks/helpers → static content.
25+
- IMPORTANT: All imports must use path aliases like "@/lib" instead of relative paths like "./" or "../"
26+
- IMPORTANT: Private methods must be prefixed with underscore (e.g., `_privateMethod()`)
2427

2528

2629
# Naming Conventions
2730
- Use PascalCase for classes.
2831
- Use camelCase for variables, functions, and methods.
2932
- Directories: Use kebab-case (e.g. components/auth-wizard).
30-
- Files: Use PascalCase (e.g. UserProfile.tsx, AuthService.ts).
33+
- Files:
34+
- Use PascalCase ONLY for files that export a class with the same name (e.g. BrowserContext.ts exports class BrowserContext)
35+
- Use lowercase for all other files: utilities, functions, interfaces, types, enums (e.g. profiler.ts, types.ts, tool.interface.ts)
36+
- Components (.tsx files) always use PascalCase (e.g. UserProfile.tsx)
3137
- Use UPPERCASE for environment variables.
3238
- Avoid magic numbers and define constants.
3339
- File extensions:
@@ -47,6 +53,35 @@ alwaysApply: true
4753
- Use arrow functions for simple cases (<3 instructions), named functions otherwise.
4854
- Use default parameter values instead of null/undefined checks.
4955
- Use RO-RO (Receive Object, Return Object) for passing and returning multiple parameters.
56+
- IMPORTANT: Order methods using "Operation-based grouping" (hybrid approach):
57+
```typescript
58+
class Example {
59+
// 1. Constructor/Initialization
60+
constructor() {}
61+
init() {}
62+
63+
// 2. Public getter methods
64+
getData() {}
65+
getStatus() {}
66+
67+
// 3. Public creator/builder methods
68+
createItem() {}
69+
buildConfig() {}
70+
71+
// 4. Public action/command methods
72+
save() {}
73+
delete() {}
74+
refresh() {}
75+
76+
// 5. Public predicate methods
77+
isReady() {}
78+
hasData() {}
79+
80+
// 6. Private helper methods (with _ prefix)
81+
private _validateData() {}
82+
private _formatOutput() {}
83+
}
84+
```
5085

5186
# Data Handling
5287
- Avoid excessive use of primitive types; encapsulate data in composite types.

0 commit comments

Comments
 (0)