kolega-code 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. kolega_code/__init__.py +151 -0
  2. kolega_code/agent/__init__.py +42 -0
  3. kolega_code/agent/baseagent.py +998 -0
  4. kolega_code/agent/browseragent.py +123 -0
  5. kolega_code/agent/coder.py +157 -0
  6. kolega_code/agent/common.py +41 -0
  7. kolega_code/agent/compression.py +81 -0
  8. kolega_code/agent/context.py +112 -0
  9. kolega_code/agent/conversation.py +408 -0
  10. kolega_code/agent/generalagent.py +146 -0
  11. kolega_code/agent/investigationagent.py +123 -0
  12. kolega_code/agent/planningagent.py +187 -0
  13. kolega_code/agent/prompt_provider.py +196 -0
  14. kolega_code/agent/prompt_templates/agents/browser.j2 +102 -0
  15. kolega_code/agent/prompt_templates/agents/coder_cli_mode.j2 +127 -0
  16. kolega_code/agent/prompt_templates/agents/general.j2 +68 -0
  17. kolega_code/agent/prompt_templates/agents/investigation.j2 +72 -0
  18. kolega_code/agent/prompt_templates/common/frontend_guidance.md +36 -0
  19. kolega_code/agent/prompt_templates/common/kolega_md_instructions.md +14 -0
  20. kolega_code/agent/prompt_templates/environment_variables/workspace_env_vars.md +11 -0
  21. kolega_code/agent/prompt_templates/template_guidance/expo-template.md +379 -0
  22. kolega_code/agent/prompt_templates/template_guidance/html-website-template.md +3 -0
  23. kolega_code/agent/prompt_templates/template_guidance/mern-stack-template.md +3 -0
  24. kolega_code/agent/prompt_templates/template_guidance/react-vite-shadcdn-template.md +182 -0
  25. kolega_code/agent/prompts.py +192 -0
  26. kolega_code/agent/tests/__init__.py +0 -0
  27. kolega_code/agent/tests/llm/__init__.py +0 -0
  28. kolega_code/agent/tests/llm/test_anthropic_token_counting.py +633 -0
  29. kolega_code/agent/tests/llm/test_billing_openai_cache.py +74 -0
  30. kolega_code/agent/tests/llm/test_client.py +773 -0
  31. kolega_code/agent/tests/llm/test_dashscope_mapping.py +32 -0
  32. kolega_code/agent/tests/llm/test_error_boundary.py +322 -0
  33. kolega_code/agent/tests/llm/test_exceptions.py +249 -0
  34. kolega_code/agent/tests/llm/test_instrumented_client.py +536 -0
  35. kolega_code/agent/tests/llm/test_instrumented_client_integration.py +547 -0
  36. kolega_code/agent/tests/llm/test_langfuse_normalization.py +39 -0
  37. kolega_code/agent/tests/llm/test_model_specs.py +17 -0
  38. kolega_code/agent/tests/llm/test_openai_cached_tokens.py +58 -0
  39. kolega_code/agent/tests/llm/test_openai_cached_tokens_stream.py +74 -0
  40. kolega_code/agent/tests/llm/test_openai_message_conversion.py +30 -0
  41. kolega_code/agent/tests/llm/test_openai_token_counting.py +687 -0
  42. kolega_code/agent/tests/llm/test_tool_execution_ids.py +193 -0
  43. kolega_code/agent/tests/services/__init__.py +1 -0
  44. kolega_code/agent/tests/services/test_browser.py +447 -0
  45. kolega_code/agent/tests/services/test_browser_parity.py +353 -0
  46. kolega_code/agent/tests/services/test_file_system.py +699 -0
  47. kolega_code/agent/tests/services/test_sandbox_terminal_input.py +98 -0
  48. kolega_code/agent/tests/services/test_terminal.py +154 -0
  49. kolega_code/agent/tests/services/test_terminal_command_tracking.py +385 -0
  50. kolega_code/agent/tests/services/test_terminal_state_serializer.py +262 -0
  51. kolega_code/agent/tests/test_agent_tools_inventory.py +267 -0
  52. kolega_code/agent/tests/test_base_agent.py +1942 -0
  53. kolega_code/agent/tests/test_coder_attachments.py +330 -0
  54. kolega_code/agent/tests/test_coder_prompt_extensions.py +61 -0
  55. kolega_code/agent/tests/test_commands.py +179 -0
  56. kolega_code/agent/tests/test_duplicate_tool_results.py +556 -0
  57. kolega_code/agent/tests/test_empty_message_handling.py +48 -0
  58. kolega_code/agent/tests/test_general_agent.py +242 -0
  59. kolega_code/agent/tests/test_html.py +320 -0
  60. kolega_code/agent/tests/test_parallel_tool_calls.py +291 -0
  61. kolega_code/agent/tests/test_planning_agent.py +227 -0
  62. kolega_code/agent/tests/test_prompt_provider.py +271 -0
  63. kolega_code/agent/tests/test_tool_registry.py +102 -0
  64. kolega_code/agent/tests/test_tools.py +549 -0
  65. kolega_code/agent/tests/tool_backend/__init__.py +0 -0
  66. kolega_code/agent/tests/tool_backend/test_agent_tool.py +356 -0
  67. kolega_code/agent/tests/tool_backend/test_base_tool.py +147 -0
  68. kolega_code/agent/tests/tool_backend/test_browser_tool.py +335 -0
  69. kolega_code/agent/tests/tool_backend/test_build_tool.py +93 -0
  70. kolega_code/agent/tests/tool_backend/test_create_file_tool.py +115 -0
  71. kolega_code/agent/tests/tool_backend/test_glob_tool.py +196 -0
  72. kolega_code/agent/tests/tool_backend/test_glob_tool_sandbox_parity.py +230 -0
  73. kolega_code/agent/tests/tool_backend/test_list_directory_tool.py +292 -0
  74. kolega_code/agent/tests/tool_backend/test_read_file_tool.py +173 -0
  75. kolega_code/agent/tests/tool_backend/test_replace_entire_file_tool.py +115 -0
  76. kolega_code/agent/tests/tool_backend/test_replace_lines_tool.py +141 -0
  77. kolega_code/agent/tests/tool_backend/test_search_and_replace_tool.py +174 -0
  78. kolega_code/agent/tests/tool_backend/test_search_codebase_tool.py +228 -0
  79. kolega_code/agent/tests/tool_backend/test_terminal_tool.py +482 -0
  80. kolega_code/agent/tests/tool_backend/test_think_hard_integration.py +189 -0
  81. kolega_code/agent/tests/tool_backend/test_think_hard_streaming.py +445 -0
  82. kolega_code/agent/tests/tool_backend/test_web_fetch_tool.py +194 -0
  83. kolega_code/agent/tool_backend/agent_tool.py +414 -0
  84. kolega_code/agent/tool_backend/apply_edit_tool.py +98 -0
  85. kolega_code/agent/tool_backend/apply_patch_tool.py +514 -0
  86. kolega_code/agent/tool_backend/base_tool.py +217 -0
  87. kolega_code/agent/tool_backend/browser_tool.py +271 -0
  88. kolega_code/agent/tool_backend/build_tool.py +93 -0
  89. kolega_code/agent/tool_backend/create_file_tool.py +52 -0
  90. kolega_code/agent/tool_backend/glob_tool.py +323 -0
  91. kolega_code/agent/tool_backend/list_directory_tool.py +300 -0
  92. kolega_code/agent/tool_backend/memory_tool.py +79 -0
  93. kolega_code/agent/tool_backend/read_file_tool.py +119 -0
  94. kolega_code/agent/tool_backend/replace_entire_file_tool.py +40 -0
  95. kolega_code/agent/tool_backend/replace_lines_tool.py +97 -0
  96. kolega_code/agent/tool_backend/search_and_replace_tool.py +146 -0
  97. kolega_code/agent/tool_backend/search_codebase_tool.py +377 -0
  98. kolega_code/agent/tool_backend/streaming_tool.py +47 -0
  99. kolega_code/agent/tool_backend/terminal_tool.py +643 -0
  100. kolega_code/agent/tool_backend/think_hard_tool.py +211 -0
  101. kolega_code/agent/tool_backend/web_fetch_tool.py +205 -0
  102. kolega_code/agent/tools.py +1704 -0
  103. kolega_code/agent/utils/commands.py +94 -0
  104. kolega_code/cli/__init__.py +1 -0
  105. kolega_code/cli/app.py +2756 -0
  106. kolega_code/cli/config.py +280 -0
  107. kolega_code/cli/connection.py +49 -0
  108. kolega_code/cli/file_index.py +147 -0
  109. kolega_code/cli/main.py +564 -0
  110. kolega_code/cli/mentions.py +155 -0
  111. kolega_code/cli/messages.py +89 -0
  112. kolega_code/cli/provider_registry.py +96 -0
  113. kolega_code/cli/session_store.py +207 -0
  114. kolega_code/cli/settings.py +87 -0
  115. kolega_code/cli/skills.py +409 -0
  116. kolega_code/cli/slash_commands.py +108 -0
  117. kolega_code/cli/tests/__init__.py +1 -0
  118. kolega_code/cli/tests/test_app.py +4251 -0
  119. kolega_code/cli/tests/test_cli_config.py +171 -0
  120. kolega_code/cli/tests/test_connection.py +26 -0
  121. kolega_code/cli/tests/test_file_index.py +103 -0
  122. kolega_code/cli/tests/test_main.py +455 -0
  123. kolega_code/cli/tests/test_mentions.py +108 -0
  124. kolega_code/cli/tests/test_session_store.py +67 -0
  125. kolega_code/cli/tests/test_settings.py +62 -0
  126. kolega_code/cli/tests/test_skills.py +157 -0
  127. kolega_code/cli/tests/test_slash_commands.py +88 -0
  128. kolega_code/cli/theme.py +180 -0
  129. kolega_code/config.py +154 -0
  130. kolega_code/events.py +202 -0
  131. kolega_code/llm/client.py +300 -0
  132. kolega_code/llm/exceptions.py +285 -0
  133. kolega_code/llm/instrumented_client.py +520 -0
  134. kolega_code/llm/models.py +1368 -0
  135. kolega_code/llm/providers/__init__.py +0 -0
  136. kolega_code/llm/providers/anthropic.py +387 -0
  137. kolega_code/llm/providers/base.py +71 -0
  138. kolega_code/llm/providers/google.py +157 -0
  139. kolega_code/llm/providers/models.py +37 -0
  140. kolega_code/llm/providers/openai.py +363 -0
  141. kolega_code/llm/ratelimit.py +40 -0
  142. kolega_code/llm/specs.py +67 -0
  143. kolega_code/llm/tool_execution_ids.py +18 -0
  144. kolega_code/models/__init__.py +9 -0
  145. kolega_code/models/sandbox_terminal_state.py +47 -0
  146. kolega_code/runtime.py +50 -0
  147. kolega_code/sandbox/README.md +200 -0
  148. kolega_code/sandbox/__init__.py +21 -0
  149. kolega_code/sandbox/async_filesystem.py +475 -0
  150. kolega_code/sandbox/base.py +297 -0
  151. kolega_code/sandbox/browser.py +25 -0
  152. kolega_code/sandbox/event_loop.py +43 -0
  153. kolega_code/sandbox/filesystem.py +341 -0
  154. kolega_code/sandbox/local.py +118 -0
  155. kolega_code/sandbox/serializer.py +175 -0
  156. kolega_code/sandbox/terminal.py +868 -0
  157. kolega_code/sandbox/utils.py +216 -0
  158. kolega_code/services/base.py +255 -0
  159. kolega_code/services/browser.py +444 -0
  160. kolega_code/services/file_system.py +749 -0
  161. kolega_code/services/html.py +221 -0
  162. kolega_code/services/terminal.py +903 -0
  163. kolega_code/tools/__init__.py +22 -0
  164. kolega_code/tools/core.py +33 -0
  165. kolega_code/tools/definitions.py +81 -0
  166. kolega_code/tools/registry.py +73 -0
  167. kolega_code-0.1.0.dist-info/METADATA +157 -0
  168. kolega_code-0.1.0.dist-info/RECORD +171 -0
  169. kolega_code-0.1.0.dist-info/WHEEL +4 -0
  170. kolega_code-0.1.0.dist-info/entry_points.txt +2 -0
  171. kolega_code-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,182 @@
1
+ ## React Vite Shadcn/UI Template Project
2
+
3
+ ### Project Overview
4
+ This is a full stack starter template with a React frontend and Hono backend. The project uses TypeScript throughout with loose configuration for easier development. The frontend runs on port 9001, the backend on port 9002, and both have been started automatically and will restart if the code changes.
5
+
6
+ ### Project Structure
7
+ ```
8
+ /
9
+ ├── frontend/ # React + Vite application
10
+ ├── backend/ # Hono API server with MongoDB
11
+ ```
12
+
13
+ #### Frontend Development (Port 9001)
14
+ - **Framework**: React 19.1.0 with Vite 7.0.4
15
+ - **Styling**: Tailwind CSS with ShadCN/UI components
16
+ - **TypeScript**: Loose configuration (no strict mode)
17
+ - **Components**: All 46 ShadCN/UI components are pre-installed in `frontend/src/components/ui/`
18
+ - **Routing**: React Router DOM with pages in `frontend/src/pages/`
19
+ - **Import paths**: Use `@/` alias for src directory (e.g., `@/components/ui/button`)
20
+
21
+ #### Backend Development (Port 9002)
22
+ - **Framework**: Hono 4.6.14 with MongoDB
23
+ - **TypeScript**: Loose configuration, builds to `./build` directory
24
+ - **CORS**: Configured to accept requests from any origin (`*`)
25
+ - **Database**: MongoDB connection via `MONGODB_URI` environment variable
26
+ - **Entry point**: `backend/index.ts`
27
+ - **Hot reload**: Enabled via tsx watch mode
28
+
29
+ ### Key Conventions
30
+
31
+ #### TypeScript
32
+ - Both frontend and backend use TypeScript 5.8.3
33
+ - Loose configuration (strict: false) for easier development
34
+ - ES modules with `.js` extensions in imports for backend
35
+
36
+ #### Code Style
37
+ - Use single quotes over double quotes
38
+ - Prefer descriptive variable names (avoid abbreviations)
39
+ - Modularize code into smaller functions
40
+ - Follow DRY principles - deduplicate code whenever possible
41
+ - Use type hints in function definitions
42
+
43
+ #### File Organization
44
+ - Frontend components go in `frontend/src/components/`
45
+ - Backend routes should be modularized in separate files
46
+ - Keep database logic in `backend/database/`
47
+
48
+ #### Making Changes
49
+
50
+ 1. **Adding Frontend Features**:
51
+ - Use existing ShadCN/UI components from `@/components/ui/`
52
+ - Add new pages in `frontend/src/pages/`
53
+ - Update routing in `frontend/src/App.tsx`
54
+
55
+ 2. **Adding Backend Endpoints**:
56
+ - Create route modules that export Hono routers
57
+ - Use the MongoDB connection from `database/connection.ts`
58
+ - Maintain consistent error handling and response formats
59
+ - The path portion of the URL should ALWAYS start with /api/
60
+
61
+ 3. **Database Operations**:
62
+ - Use `get_database()` to access the MongoDB instance
63
+ - Handle connection errors gracefully
64
+ - Keep connection logic centralized
65
+
66
+ 4. **Environment Variables**:
67
+ - Backend uses `MONGODB_URI` and `DATABASE_NAME`
68
+
69
+ #### Testing Changes
70
+ - Frontend changes appear instantly via HMR
71
+ - Backend changes reload automatically via tsx
72
+ - Build both projects using the `build_backend` and `build_frontend` tools to verify production readiness
73
+
74
+ ### Hono Backend Cheat Sheet
75
+
76
+ #### Basic Route Handlers
77
+ ```typescript
78
+ // GET request
79
+ app.get('/users', async (c) => {
80
+ const users = await get_users_from_db();
81
+ return c.json({ users });
82
+ });
83
+
84
+ // POST request with body parsing
85
+ app.post('/users', async (c) => {
86
+ const body = await c.req.json();
87
+ const { name, email } = body;
88
+ // Process data...
89
+ return c.json({ message: 'User created' }, 201);
90
+ });
91
+
92
+ // Route parameters
93
+ app.get('/users/:id', async (c) => {
94
+ const id = c.req.param('id');
95
+ const user = await get_user_by_id(id);
96
+ return c.json({ user });
97
+ });
98
+
99
+ // Query parameters
100
+ app.get('/search', async (c) => {
101
+ const query = c.req.query('q');
102
+ const limit = c.req.query('limit') || '10';
103
+ // Search logic...
104
+ return c.json({ results });
105
+ });
106
+ ```
107
+
108
+ #### MongoDB Integration Pattern
109
+ ```typescript
110
+ import { get_database } from './database/connection.js';
111
+
112
+ app.get('/items', async (c) => {
113
+ try {
114
+ const db = get_database();
115
+ const items = await db.collection('items').find({}).toArray();
116
+ return c.json({ success: true, items });
117
+ } catch (error) {
118
+ return c.json({ success: false, error: error.message }, 500);
119
+ }
120
+ });
121
+ ```
122
+
123
+ #### Creating Modular Routes
124
+ ```typescript
125
+ // routes/user_routes.ts
126
+ import { Hono } from 'hono';
127
+
128
+ export const create_user_routes = (): Hono => {
129
+ const router = new Hono();
130
+
131
+ router.get('/', async (c) => {
132
+ // List users
133
+ });
134
+
135
+ router.post('/', async (c) => {
136
+ // Create user
137
+ });
138
+
139
+ return router;
140
+ };
141
+
142
+ // In index.ts
143
+ import { create_user_routes } from './routes/user_routes.js';
144
+ app.route('/api/users', create_user_routes());
145
+ ```
146
+
147
+ #### Common Response Patterns
148
+ ```typescript
149
+ // Success response
150
+ return c.json({ success: true, data: result });
151
+
152
+ // Error response
153
+ return c.json({ success: false, error: 'Not found' }, 404);
154
+
155
+ // Redirect
156
+ return c.redirect('/new-location');
157
+
158
+ // Set headers
159
+ c.header('X-Custom-Header', 'value');
160
+ return c.json({ data });
161
+
162
+ // Set status
163
+ return c.text('Created', 201);
164
+ ```
165
+
166
+ #### Middleware Pattern
167
+ ```typescript
168
+ // Custom middleware
169
+ app.use('*', async (c, next) => {
170
+ console.log(`${c.req.method} ${c.req.path}`);
171
+ await next();
172
+ });
173
+
174
+ // Protected routes
175
+ app.use('/api/*', async (c, next) => {
176
+ const token = c.req.header('Authorization');
177
+ if (!token) {
178
+ return c.json({ error: 'Unauthorized' }, 401);
179
+ }
180
+ await next();
181
+ });
182
+ ```
@@ -0,0 +1,192 @@
1
+ THINK_HARD_PROMPT = """
2
+ You are a brilliant software architect and problem solver with expertise in system design and debugging. When presented with a problem:
3
+
4
+ 1. First, clearly restate the problem to ensure complete understanding
5
+ 2. Break the problem down into its fundamental components and identify core challenges
6
+ 3. Consider multiple architectural approaches, weighing their tradeoffs (performance, maintainability, scalability, etc.)
7
+ 4. Analyze potential edge cases and failure modes
8
+ 5. Draw from relevant design patterns and best practices
9
+ 6. Think about both immediate solutions and long-term implications
10
+ 7. Consider how the solution integrates with existing systems
11
+ 8. Evaluate technical debt implications of different approaches
12
+ 9. Propose concrete implementation steps with code examples where helpful
13
+
14
+ Show your complete thinking process, including paths you considered but rejected and why. Be methodical, thorough, and detailed in your analysis. Prioritize clarity and depth over brevity.
15
+ """
16
+
17
+
18
+ COMPRESSION_SUMMARY_SYSTEM_PROMPT = """
19
+ You are an expert at analyzing and summarizing technical coding conversations. Your task is to create comprehensive, structured summaries of conversations between users and coding assistants.
20
+
21
+ Your summaries must follow this exact structure:
22
+
23
+ ## Analysis Section
24
+ Provide a chronological, detailed walkthrough of the entire conversation. Number each major interaction and describe:
25
+ - What the user requested
26
+ - How the assistant approached the problem
27
+ - What files were read/modified/created
28
+ - Key decisions and discoveries made
29
+ - Any iterations or corrections
30
+
31
+ ## Summary Section
32
+ Create a detailed summary with these exact subsections:
33
+
34
+ ### 1. Primary Request and Intent
35
+ List all explicit user requests in order. Be clear and specific about what the user wanted to accomplish.
36
+
37
+ ### 2. Key Technical Concepts
38
+ List all relevant technologies, frameworks, libraries, architectural patterns, and technical concepts used or discussed.
39
+
40
+ ### 3. Files and Code Sections
41
+ For EACH file that was modified or created:
42
+ - **Full file path** (in bold)
43
+ - **(Created)** or **(Modified)** indicator
44
+ - **Why**: Brief explanation of why this file was changed
45
+ - **Changes**: Detailed description with actual code snippets showing the key changes
46
+ - Include line numbers when relevant
47
+ - Show enough code context to understand the change
48
+
49
+ ### 4. Errors and Fixes
50
+ Document any errors encountered, incorrect approaches, or debugging that occurred. If none, explicitly state "No explicit errors occurred."
51
+
52
+ ### 5. Problem Solving
53
+ Describe:
54
+ - **Problems Solved**: What issues were addressed and how
55
+ - **Key Architectural Decisions**: Important technical choices and their rationale
56
+
57
+ ### 6. All User Messages
58
+ List every user message verbatim (excluding the current summary request).
59
+
60
+ ### 7. Pending Tasks
61
+ List any incomplete work, explicitly mentioned future tasks, or known issues. If none, state "No pending tasks."
62
+
63
+ ### 8. Current Work
64
+ Describe the most recent work completed in detail, including the specific file(s) and changes made.
65
+
66
+ ### 9. Optional Next Step
67
+ Suggest a logical next step if appropriate, or state that no next step is needed.
68
+
69
+ ## Formatting Requirements
70
+ - Use markdown headers (##, ###)
71
+ - Use **bold** for file paths and important labels
72
+ - Use `code blocks` for all code snippets
73
+ - Use bullet points and numbered lists for clarity
74
+ - Be precise with technical terminology
75
+ - Include actual code snippets, not just descriptions
76
+ - Maintain chronological order in the Analysis section
77
+ - Be comprehensive but concise
78
+ """
79
+
80
+
81
+ COMPRESSION_SUMMARY_USER_PROMPT_TEMPLATE = """
82
+ Please create a comprehensive summary of the following coding conversation. Follow the structured format exactly as specified in your instructions.
83
+
84
+ <conversation_history>
85
+ {HISTORY}
86
+ </conversation_history>
87
+
88
+ Create a detailed summary that captures:
89
+ 1. The complete chronological flow of the conversation
90
+ 2. All technical decisions and implementations
91
+ 3. Every file that was modified or created with code snippets
92
+ 4. Any problems encountered and how they were solved
93
+ 5. The current state and any pending work
94
+
95
+ Format your response as:
96
+ - An Analysis section with chronological walkthrough
97
+ - A Summary section with all 9 required subsections
98
+
99
+ Be thorough and include actual code snippets from the conversation.
100
+ """
101
+
102
+
103
+ APPLY_EDIT_SYSTEM_PROMPT = """
104
+ You are an expert code editor. Your task is to precisely apply edits to a file by integrating new code into the existing codebase.
105
+
106
+ Follow these rules exactly:
107
+ 1. Carefully analyze both the original code and the update snippet
108
+ 2. Determine where and how the update should be integrated
109
+ 3. Preserve all indentation, formatting, and style from the original code
110
+ 4. Return the complete updated code, not just the changed portions
111
+ 5. Make only the changes necessary to implement the update
112
+ 6. If the update contains markers like '// ... existing code ...', use them to understand where code should be preserved
113
+ """
114
+
115
+
116
+ APPLY_EDIT_USER_PROMPT = """
117
+ I need you to apply an edit to a code file. Below you'll find the original code and an update snippet.
118
+
119
+ The update snippet contains markers like '// ... existing code ...' to indicate unchanged portions of the file.
120
+ Your task is to integrate the changes from the update snippet into the original code.
121
+
122
+ You have been given the following instructions:
123
+ <instructions>
124
+ {instructions}
125
+ </instructions>
126
+
127
+ <original-code>
128
+ {original_code}
129
+ </original-code>
130
+
131
+ <code-edit>
132
+ {code_edit}
133
+ </update-snippet>
134
+
135
+ Please return the complete updated code within <updated-code> tags.
136
+
137
+ IMPORTANT: Do not make unnecessary changes. Only update what is necessary. In general, you should not change any code that is not included in the update snippet.
138
+ """
139
+
140
+
141
+ SHELL_SAFETY_SYSTEM_PROMPT = """
142
+ You are a security expert evaluating shell commands for safety. Your task is to determine if a command is safe to execute.
143
+
144
+ Rules for safe commands:
145
+ - Commands that modify files within the project's working directory (e.g. git, npm, pip, file operations)
146
+ - Commands to delete files within the project's working directory
147
+ - Basic directory navigation (cd, ls, pwd)
148
+ - Reading file contents (cat, less, head, tail)
149
+ - Package management within the project scope
150
+ - Build and test commands
151
+ - Starting and stopping development servers running on arbitrary ports
152
+ - In general, anything that is valid in the context of working on a software project
153
+
154
+ Unsafe commands include:
155
+ - Accessing files outside project directory
156
+ - Network/firewall modifications
157
+ - System configuration changes
158
+ - User/permission modifications
159
+ - Operations that are destruction to the system (rm -rf /, format)
160
+ - Running arbitrary downloaded code
161
+ - Opening security vulnerabilities
162
+
163
+ If the command is safe, respond only with: safe
164
+ If unsafe, provide a brief reason why in under 20 words.
165
+ """
166
+
167
+
168
+ SHELL_COMPRESSION_SYSTEM_PROMPT = """
169
+ You are an expert at analyzing shell command output. Your task is to extract and
170
+ summarize the most relevant information from command output.
171
+
172
+ Given:
173
+ 1. The original command that was run
174
+ 2. The purpose/intent of running that command
175
+ 3. The raw command output
176
+
177
+ Rules:
178
+ - Focus on information that helps achieve the stated purpose
179
+ - Extract error messages and warnings if present
180
+ - For build/install commands, report success/failure and any key issues
181
+ - For file operations, confirm if they completed successfully
182
+ - For test output, summarize pass/fail counts and key failures
183
+ - Remove unnecessary formatting, timestamps, and verbose logs
184
+ - Keep version numbers, file paths, and other specific details when relevant
185
+
186
+ Respond with a clear, concise summary that helps the agent understand:
187
+ 1. What were the key results/findings?
188
+ 2. Are there any issues that need to be addressed?
189
+
190
+ Keep summaries brief but include all critical information. Format in clear sections if needed.
191
+ If there are specific error messages or tracebacks, include them as Markdown code blocks.
192
+ """
File without changes
File without changes