@umituz/react-native-ai-gemini-provider 1.14.27 → 1.14.29

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 (48) hide show
  1. package/package.json +1 -1
  2. package/src/domain/README.md +232 -0
  3. package/src/domain/constants/README.md +191 -0
  4. package/src/domain/entities/README.md +238 -0
  5. package/src/infrastructure/README.md +252 -0
  6. package/src/infrastructure/cache/CACHE_SYSTEM.md +213 -0
  7. package/src/infrastructure/cache/README.md +213 -0
  8. package/src/infrastructure/content/CONTENT_BUILDER.md +175 -0
  9. package/src/infrastructure/content/README.md +175 -0
  10. package/src/infrastructure/interceptors/README.md +226 -0
  11. package/src/infrastructure/interceptors/REQUEST_INTERCEPTORS.md +171 -0
  12. package/src/infrastructure/job/JOB_MANAGER.md +174 -0
  13. package/src/infrastructure/job/README.md +194 -0
  14. package/src/infrastructure/response/README.md +187 -0
  15. package/src/infrastructure/response/RESPONSE_FORMATTER.md +185 -0
  16. package/src/infrastructure/services/CORE_CLIENT_SERVICE.md +202 -0
  17. package/src/infrastructure/services/FEATURE_MODEL_SELECTOR_SERVICE.md +206 -0
  18. package/src/infrastructure/services/GENERATION_EXECUTOR_SERVICE.md +176 -0
  19. package/src/infrastructure/services/IMAGE_EDIT_SERVICE.md +169 -0
  20. package/src/infrastructure/services/IMAGE_GENERATION_SERVICE.md +166 -0
  21. package/src/infrastructure/services/JOB_PROCESSOR_SERVICE.md +174 -0
  22. package/src/infrastructure/services/PROVIDER_INITIALIZER_SERVICE.md +176 -0
  23. package/src/infrastructure/services/README.md +233 -0
  24. package/src/infrastructure/services/RETRY_SERVICE.md +178 -0
  25. package/src/infrastructure/services/STREAMING_SERVICE.md +166 -0
  26. package/src/infrastructure/services/STRUCTURED_TEXT_SERVICE.md +175 -0
  27. package/src/infrastructure/services/TEXT_GENERATION_SERVICE.md +160 -0
  28. package/src/infrastructure/services/VEO_HTTP_CLIENT_SERVICE.md +179 -0
  29. package/src/infrastructure/services/VEO_POLLING_SERVICE.md +173 -0
  30. package/src/infrastructure/services/VIDEO_DOWNLOADER_SERVICE.md +166 -0
  31. package/src/infrastructure/services/VIDEO_ERROR_HANDLER_SERVICE.md +185 -0
  32. package/src/infrastructure/services/VIDEO_GENERATION_SERVICE.md +176 -0
  33. package/src/infrastructure/services/VIDEO_URL_EXTRACTOR_SERVICE.md +186 -0
  34. package/src/infrastructure/telemetry/README.md +203 -0
  35. package/src/infrastructure/telemetry/TELEMETRY_SYSTEM.md +200 -0
  36. package/src/infrastructure/utils/DATA_TRANSFORMER_UTILS.md +175 -0
  37. package/src/infrastructure/utils/ERROR_MAPPER.md +170 -0
  38. package/src/infrastructure/utils/ERROR_UTILITIES.md +208 -0
  39. package/src/infrastructure/utils/IMAGE_PREPARER_UTILS.md +185 -0
  40. package/src/infrastructure/utils/INPUT_BUILDERS.md +214 -0
  41. package/src/infrastructure/utils/MODEL_VALIDATION_UTILS.md +189 -0
  42. package/src/infrastructure/utils/PERFORMANCE_UTILITIES.md +477 -0
  43. package/src/infrastructure/utils/PERFORMANCE_UTILS.md +219 -0
  44. package/src/infrastructure/utils/README.md +289 -0
  45. package/src/presentation/README.md +187 -0
  46. package/src/presentation/hooks/README.md +188 -0
  47. package/src/presentation/hooks/USE_GEMINI_HOOK.md +226 -0
  48. package/src/providers/README.md +247 -0
@@ -0,0 +1,175 @@
1
+ # Content Builder
2
+
3
+ Builder class for creating Gemini API content structures. Provides type-safe methods for building text, image, and file content parts.
4
+
5
+ ## 📍 Import Path
6
+
7
+ ```
8
+ import { ContentBuilder } from '@umituz/react-native-ai-gemini-provider';
9
+ ```
10
+
11
+ ## 🎯 Purpose
12
+
13
+ Use ContentBuilder to create properly formatted Gemini content objects. Handles text, images, and file data for multimodal inputs.
14
+
15
+ **When to use:**
16
+ - Build content for text generation
17
+ - Create multimodal content (text + images)
18
+ - Format chat messages
19
+ - Add file data to requests
20
+ - Build conversation history
21
+
22
+ ## 📌 Strategy
23
+
24
+ ContentBuilder ensures correct API format. This class:
25
+ - Creates properly structured content objects
26
+ - Handles different content types (text, images, files)
27
+ - Simplifies multimodal content creation
28
+ - Provides consistent formatting
29
+ - Validates content structure
30
+
31
+ **Key Decision**: Use ContentBuilder for all content creation. Ensures compatibility with Gemini API format.
32
+
33
+ ## ⚠️ Rules
34
+
35
+ ### Content Creation Rules
36
+ - **MUST** specify role (user or model)
37
+ - **SHOULD** use builder methods
38
+ - **MUST** provide valid parts array
39
+ - **SHOULD** validate content structure
40
+ - **MUST NOT** create malformed content
41
+
42
+ ### Content Part Rules
43
+ - **MUST** use correct MIME types
44
+ - **SHOULD** provide valid base64 data
45
+ - **MUST** handle encoding properly
46
+ - **SHOULD** validate image data
47
+ - **MUST NOT** use invalid formats
48
+
49
+ ### Multimodal Rules
50
+ - **SHOULD** include text with images
51
+ - **MUST** order parts appropriately
52
+ - **SHOULD** limit image count
53
+ - **MUST** handle mixed content types
54
+ - **SHOULD NOT** exceed size limits
55
+
56
+ ### Best Practices Rules
57
+ - **SHOULD** use builder for consistency
58
+ - **MUST** validate content before sending
59
+ - **SHOULD** handle build errors
60
+ - **MUST** use appropriate MIME types
61
+ - **SHOULD** test content structures
62
+
63
+ ## 🤖 AI Agent Guidelines
64
+
65
+ ### When Building Text Content
66
+ 1. **CREATE** ContentBuilder instance
67
+ 2. **BUILD** text part
68
+ 3. **CREATE** content with role
69
+ 4. **VALIDATE** structure
70
+ 5. **RETURN** content object
71
+
72
+ ### When Building Multimodal Content
73
+ 1. **CREATE** ContentBuilder instance
74
+ 2. **BUILD** text part
75
+ 3. **BUILD** image data parts
76
+ 4. **COMBINE** parts in array
77
+ 5. **CREATE** content object
78
+
79
+ ### When Building Chat History
80
+ 1. **CREATE** ContentBuilder instance
81
+ 2. **BUILD** user messages
82
+ 3. **BUILD** model responses
83
+ 4. **COMBINE** in array
84
+ 5. **RETURN** conversation array
85
+
86
+ ### Code Style Rules
87
+ - **USE** builder methods
88
+ - **VALIDATE** inputs
89
+ - **HANDLE** errors gracefully
90
+ - **COMMENT** complex content
91
+ - **TEST** content structures
92
+
93
+ ## 📦 Available Class
94
+
95
+ ### ContentBuilder
96
+
97
+ **Refer to**: [`ContentBuilder.ts`](./ContentBuilder.ts)
98
+
99
+ **Methods:**
100
+ - `buildContent(role, parts)` - Build GeminiContent object
101
+ - `buildTextPart(text)` - Build text part
102
+ - `buildImageDataPart(mimeType, data)` - Build image data part
103
+ - `buildFileDataPart(mimeType, fileUri)` - Build file data part
104
+
105
+ ## 🔗 Related Modules
106
+
107
+ - **Domain Entities**: [`../../domain/entities/README.md`](../../domain/entities/README.md)
108
+ - **Text Generation**: [`../services/TEXT_GENERATION_SERVICE.md`](../services/TEXT_GENERATION_SERVICE.md)
109
+ - **Infrastructure README**: [`../infrastructure/README.md`](../infrastructure/README.md)
110
+
111
+ ## 📋 Supported MIME Types
112
+
113
+ ### Image Formats
114
+ - `image/png` - PNG images
115
+ - `image/jpeg` - JPEG images
116
+ - `image/webp` - WebP images
117
+ - `image/heic` - HEIC images
118
+ - `image/heif` - HEIF images
119
+
120
+ ### Document Formats
121
+ - `application/pdf` - PDF documents
122
+ - `text/plain` - Plain text
123
+ - `text/html` - HTML documents
124
+ - `application/json` - JSON data
125
+
126
+ ## 🎓 Usage Patterns
127
+
128
+ ### Basic Text Content
129
+ 1. Create ContentBuilder instance
130
+ 2. Build text part
131
+ 3. Create content with role
132
+ 4. Use in service call
133
+ 5. Handle response
134
+
135
+ ### Multimodal Content
136
+ 1. Create ContentBuilder instance
137
+ 2. Build text part
138
+ 3. Build image data parts
139
+ 4. Combine all parts
140
+ 5. Create content with role
141
+
142
+ ### Chat Conversation
143
+ 1. Create ContentBuilder instance
144
+ 2. Build user message content
145
+ 3. Build model response content
146
+ 4. Repeat for conversation
147
+ 5. Return content array
148
+
149
+ ### File-Based Content
150
+ 1. Create ContentBuilder instance
151
+ 2. Build text instruction
152
+ 3. Build file data part
153
+ 4. Create content with role
154
+ 5. Process file
155
+
156
+ ## 🚨 Common Pitfalls
157
+
158
+ ### Don't
159
+ - Create content objects manually
160
+ - Skip role specification
161
+ - Use invalid MIME types
162
+ - Forget to validate content
163
+ - Mix up part order
164
+
165
+ ### Do
166
+ - Use ContentBuilder for all content
167
+ - Always specify role
168
+ - Validate MIME types
169
+ - Test content structure
170
+ - Follow API format
171
+
172
+ ---
173
+
174
+ **Last Updated**: 2025-01-08
175
+ **See Also**: [AI_GUIDELINES.md](../../../../AI_GUIDELINES.md)
@@ -0,0 +1,175 @@
1
+ # Content Builder
2
+
3
+ Helper class for building content structures for Gemini API. Creates properly formatted content objects with text, images, and files.
4
+
5
+ ## 📍 Import Path
6
+
7
+ ```
8
+ import { ContentBuilder } from '@umituz/react-native-ai-gemini-provider';
9
+ ```
10
+
11
+ ## 🎯 Purpose
12
+
13
+ Use ContentBuilder to create properly formatted Gemini content objects. Handles text, images, and file data for multimodal inputs.
14
+
15
+ **When to use:**
16
+ - Build content for text generation
17
+ - Create multimodal content (text + images)
18
+ - Format chat messages
19
+ - Add file data to requests
20
+ - Build conversation history
21
+
22
+ ## 📌 Strategy
23
+
24
+ ContentBuilder ensures correct API format. This class:
25
+ - Creates properly structured content objects
26
+ - Handles different content types (text, images, files)
27
+ - Simplifies multimodal content creation
28
+ - Provides consistent formatting
29
+ - Validates content structure
30
+
31
+ **Key Decision**: Use ContentBuilder for all content creation. Ensures compatibility with Gemini API format.
32
+
33
+ ## ⚠️ Rules
34
+
35
+ ### Content Creation Rules
36
+ - **MUST** specify role (user or model)
37
+ - **SHOULD** use builder methods
38
+ - **MUST** provide valid parts array
39
+ - **SHOULD** validate content structure
40
+ - **MUST NOT** create malformed content
41
+
42
+ ### Content Part Rules
43
+ - **MUST** use correct MIME types
44
+ - **SHOULD** provide valid base64 data
45
+ - **MUST** handle encoding properly
46
+ - **SHOULD** validate image data
47
+ - **MUST NOT** use invalid formats
48
+
49
+ ### Multimodal Rules
50
+ - **SHOULD** include text with images
51
+ - **MUST** order parts appropriately
52
+ - **SHOULD** limit image count
53
+ - **MUST** handle mixed content types
54
+ - **SHOULD NOT** exceed size limits
55
+
56
+ ### Best Practices Rules
57
+ - **SHOULD** use builder for consistency
58
+ - **MUST** validate content before sending
59
+ - **SHOULD** handle build errors
60
+ - **MUST** use appropriate MIME types
61
+ - **SHOULD** test content structures
62
+
63
+ ## 🤖 AI Agent Guidelines
64
+
65
+ ### When Building Text Content
66
+ 1. **CREATE** ContentBuilder instance
67
+ 2. **BUILD** text part
68
+ 3. **CREATE** content with role
69
+ 4. **VALIDATE** structure
70
+ 5. **RETURN** content object
71
+
72
+ ### When Building Multimodal Content
73
+ 1. **CREATE** ContentBuilder instance
74
+ 2. **BUILD** text part
75
+ 3. **BUILD** image data parts
76
+ 4. **COMBINE** parts in array
77
+ 5. **CREATE** content object
78
+
79
+ ### When Building Chat History
80
+ 1. **CREATE** ContentBuilder instance
81
+ 2. **BUILD** user messages
82
+ 3. **BUILD** model responses
83
+ 4. **COMBINE** in array
84
+ 5. **RETURN** conversation array
85
+
86
+ ### Code Style Rules
87
+ - **USE** builder methods
88
+ - **VALIDATE** inputs
89
+ - **HANDLE** errors gracefully
90
+ - **COMMENT** complex content
91
+ - **TEST** content structures
92
+
93
+ ## 📦 Available Class
94
+
95
+ ### ContentBuilder
96
+
97
+ **Refer to**: [`ContentBuilder.ts`](./ContentBuilder.ts)
98
+
99
+ **Methods:**
100
+ - `buildContent(role, parts)` - Build GeminiContent object
101
+ - `buildTextPart(text)` - Build text part
102
+ - `buildImageDataPart(mimeType, data)` - Build image data part
103
+ - `buildFileDataPart(mimeType, fileUri)` - Build file data part
104
+
105
+ ## 🔗 Related Modules
106
+
107
+ - **Domain Entities**: [`../../domain/entities/README.md`](../../domain/entities/README.md)
108
+ - **Text Generation**: [`../services/TEXT_GENERATION_SERVICE.md`](../services/TEXT_GENERATION_SERVICE.md)
109
+ - **Infrastructure README**: [`../infrastructure/README.md`](../infrastructure/README.md)
110
+
111
+ ## 📋 Supported MIME Types
112
+
113
+ ### Image Formats
114
+ - `image/png` - PNG images
115
+ - `image/jpeg` - JPEG images
116
+ - `image/webp` - WebP images
117
+ - `image/heic` - HEIC images
118
+ - `image/heif` - HEIF images
119
+
120
+ ### Document Formats
121
+ - `application/pdf` - PDF documents
122
+ - `text/plain` - Plain text
123
+ - `text/html` - HTML documents
124
+ - `application/json` - JSON data
125
+
126
+ ## 🎓 Usage Patterns
127
+
128
+ ### Basic Text Content
129
+ 1. Create ContentBuilder instance
130
+ 2. Build text part
131
+ 3. Create content with role
132
+ 4. Use in service call
133
+ 5. Handle response
134
+
135
+ ### Multimodal Content
136
+ 1. Create ContentBuilder instance
137
+ 2. Build text part
138
+ 3. Build image data parts
139
+ 4. Combine all parts
140
+ 5. Create content with role
141
+
142
+ ### Chat Conversation
143
+ 1. Create ContentBuilder instance
144
+ 2. Build user message content
145
+ 3. Build model response content
146
+ 4. Repeat for conversation
147
+ 5. Return content array
148
+
149
+ ### File-Based Content
150
+ 1. Create ContentBuilder instance
151
+ 2. Build text instruction
152
+ 3. Build file data part
153
+ 4. Create content with role
154
+ 5. Process file
155
+
156
+ ## 🚨 Common Pitfalls
157
+
158
+ ### Don't
159
+ - Create content objects manually
160
+ - Skip role specification
161
+ - Use invalid MIME types
162
+ - Forget to validate content
163
+ - Mix up part order
164
+
165
+ ### Do
166
+ - Use ContentBuilder for all content
167
+ - Always specify role
168
+ - Validate MIME types
169
+ - Test content structure
170
+ - Follow API format
171
+
172
+ ---
173
+
174
+ **Last Updated**: 2025-01-08
175
+ **See Also**: [AI_GUIDELINES.md](../../../../AI_GUIDELINES.md)
@@ -0,0 +1,226 @@
1
+ # Interceptors Module
2
+
3
+ Middleware system for transforming requests and responses. Manages authentication, logging, transformation, and other cross-cutting concerns from a central location.
4
+
5
+ ## 📍 Import Path
6
+
7
+ ```
8
+ import {
9
+ requestInterceptors,
10
+ responseInterceptors
11
+ } from '@umituz/react-native-ai-gemini-provider';
12
+ ```
13
+
14
+ ## 🎯 Purpose
15
+
16
+ Use interceptors to modify API requests before sending and responses after receiving. Provides centralized middleware for authentication, logging, validation, caching, and data transformation.
17
+
18
+ **When to use:**
19
+ - Add authentication headers to requests
20
+ - Log and monitor API calls
21
+ - Transform request/response data
22
+ - Implement rate limiting
23
+ - Validate payloads
24
+ - Add custom headers
25
+ - Cache responses
26
+ - Handle errors globally
27
+ - Enrich response data
28
+
29
+ ## 📌 Strategy
30
+
31
+ Interceptors provide a clean separation of concerns. This system:
32
+ - Executes request interceptors in order (first added runs first)
33
+ - Executes response interceptors in reverse order (last added runs first)
34
+ - Returns unsubscribe functions for cleanup
35
+ - Supports async interceptors
36
+ - Maintains immutability of context
37
+ - Enables composable middleware chains
38
+
39
+ **Key Decision**: Use interceptors for cross-cutting concerns. Keep business logic in services, use interceptors for operational concerns like logging, auth, and transformation.
40
+
41
+ ## ⚠️ Rules
42
+
43
+ ### Usage Rules
44
+ - **MUST** return modified context from interceptors
45
+ - **SHOULD** handle errors in interceptors gracefully
46
+ - **MUST** unsubscribe from interceptors when done
47
+ - **SHOULD NOT** block execution excessively
48
+ - **MUST** maintain execution order dependency
49
+
50
+ ### Request Interceptor Rules
51
+ - **MUST** return RequestContext object
52
+ - **SHOULD** validate inputs in interceptors
53
+ - **MUST NOT** mutate original context directly
54
+ - **SHOULD** handle async operations properly
55
+ - **MUST NOT** throw errors from interceptors
56
+
57
+ ### Response Interceptor Rules
58
+ - **MUST** return ResponseContext object
59
+ - **SHOULD** check for errors in responses
60
+ - **MUST NOT** expose sensitive data
61
+ - **SHOULD** transform data appropriately
62
+ - **MUST** handle undefined responses
63
+
64
+ ### Best Practices Rules
65
+ - **SHOULD** add logging interceptor first
66
+ - **MUST** clean up interceptors on unmount
67
+ - **SHOULD NOT** create circular dependencies
68
+ - **MUST** return new context objects
69
+ - **SHOULD** keep interceptors lightweight
70
+
71
+ ## 🤖 AI Agent Guidelines
72
+
73
+ ### When Adding Interceptors
74
+ 1. **READ** existing interceptor patterns first
75
+ 2. **UNDERSTAND** execution order (request: FIFO, response: LIFO)
76
+ 3. **IMPLEMENT** error handling
77
+ 4. **RETURN** modified context
78
+ 5. **TEST** interceptor in isolation
79
+
80
+ ### When Removing Interceptors
81
+ 1. **CALL** unsubscribe function
82
+ 2. **VERIFY** no memory leaks
83
+ 3. **UPDATE** dependent code
84
+ 4. **TEST** after removal
85
+ 5. **DOCUMENT** removal reason
86
+
87
+ ### When Debugging Interceptors
88
+ 1. **ADD** debug interceptor at start/end of chain
89
+ 2. **LOG** context before/after modifications
90
+ 3. **CHECK** execution order
91
+ 4. **VERIFY** context immutability
92
+ 5. **TEST** with various scenarios
93
+
94
+ ### Code Style Rules
95
+ - **USE** async/await for async operations
96
+ - **RETURN** new context objects (spread operator)
97
+ - **HANDLE** errors with try-catch
98
+ - **LOG** important operations
99
+ - **COMMENT** complex transformation logic
100
+
101
+ ## 📦 Available Interceptors
102
+
103
+ ### Request Interceptors
104
+
105
+ **Refer to**: [`RequestInterceptors.ts`](./RequestInterceptors.ts)
106
+
107
+ **Methods:**
108
+ - `use(interceptor)` - Add interceptor
109
+ - `apply(context)` - Apply all interceptors
110
+ - `clear()` - Clear all interceptors
111
+ - `count()` - Get interceptor count
112
+
113
+ **Execution Order:** First added runs first (FIFO)
114
+
115
+ ### Response Interceptors
116
+
117
+ **Refer to**: [`ResponseInterceptors.ts`](./ResponseInterceptors.ts)
118
+
119
+ **Methods:**
120
+ - `use(interceptor)` - Add interceptor
121
+ - `apply(context)` - Apply all interceptors
122
+ - `clear()` - Clear all interceptors
123
+ - `count()` - Get interceptor count
124
+
125
+ **Execution Order:** Last added runs first (LIFO)
126
+
127
+ ## 🔗 Related Modules
128
+
129
+ - **Infrastructure README**: [`../infrastructure/README.md`](../infrastructure/README.md)
130
+ - **Services**: [`../services/README.md`](../services/README.md)
131
+ - **Telemetry**: [`../telemetry/README.md`](../telemetry/README.md)
132
+
133
+ ## 📋 Interceptor Patterns
134
+
135
+ ### Authentication Pattern
136
+ 1. Add interceptor before operations
137
+ 2. Inject API key/token into context
138
+ 3. Return modified context
139
+ 4. Handle missing credentials
140
+ 5. Clean up interceptor when done
141
+
142
+ ### Logging Pattern
143
+ 1. Add interceptor at start of chain
144
+ 2. Log request/response details
145
+ 3. Include timing information
146
+ 4. Return context unchanged
147
+ 5. Avoid logging sensitive data
148
+
149
+ ### Transformation Pattern
150
+ 1. Add interceptor for specific transformation
151
+ 2. Extract data from context
152
+ 3. Apply transformation logic
153
+ 4. Return new context with transformed data
154
+ 5. Handle transformation errors
155
+
156
+ ### Caching Pattern
157
+ 1. Add response interceptor
158
+ 2. Check response status
159
+ 3. Cache successful responses
160
+ 4. Return context unchanged
161
+ 5. Handle cache errors gracefully
162
+
163
+ ### Validation Pattern
164
+ 1. Add request interceptor
165
+ 2. Validate context payload
166
+ 3. Check required fields
167
+ 4. Throw on validation failure
168
+ 5. Return context if valid
169
+
170
+ ## 🎓 Usage Patterns
171
+
172
+ ### Request Interception
173
+ 1. Import `requestInterceptors`
174
+ 2. Call `use()` with interceptor function
175
+ 3. Modify and return RequestContext
176
+ 4. Store unsubscribe function
177
+ 5. Call unsubscribe on cleanup
178
+
179
+ ### Response Interception
180
+ 1. Import `responseInterceptors`
181
+ 2. Call `use()` with interceptor function
182
+ 3. Modify and return ResponseContext
183
+ 4. Store unsubscribe function
184
+ 5. Call unsubscribe on cleanup
185
+
186
+ ### Chained Interceptors
187
+ 1. Add interceptors in desired order
188
+ 2. Request: First added runs first
189
+ 3. Response: Last added runs first
190
+ 4. Store all unsubscribe functions
191
+ 5. Clean up all on unmount
192
+
193
+ ### Conditional Interceptors
194
+ 1. Check environment/conditions
195
+ 2. Add interceptor only if needed
196
+ 3. Return early from interceptor if not applicable
197
+ 4. Keep conditional logic simple
198
+ 5. Test both conditional paths
199
+
200
+ ### Async Interceptors
201
+ 1. Make interceptor function async
202
+ 2. Use await for async operations
203
+ 3. Handle async errors
204
+ 4. Return modified context
205
+ 5. Test async behavior
206
+
207
+ ## 🚨 Common Pitfalls
208
+
209
+ ### Don't
210
+ - Mutate original context object
211
+ - Forget to unsubscribe from interceptors
212
+ - Block execution with heavy operations
213
+ - Throw errors from interceptors
214
+ - Create circular dependencies between interceptors
215
+
216
+ ### Do
217
+ - Return new context objects
218
+ - Clean up interceptors when done
219
+ - Keep interceptors lightweight
220
+ - Handle errors gracefully
221
+ - Follow execution order rules
222
+
223
+ ---
224
+
225
+ **Last Updated**: 2025-01-08
226
+ **See Also**: [AI_GUIDELINES.md](../../../../AI_GUIDELINES.md)