@minded-ai/mindedjs 1.0.0-ec2-beta-170 → 1.0.0-ec2-beta-172

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.
@@ -185,7 +185,7 @@ class LogsCapture:
185
185
  self.s3_client = self.boto3.client('s3', region_name=self.aws_region)
186
186
 
187
187
  # Track accumulated logs
188
- self.log_entries: List[Dict[str, Any]] = []
188
+ self.log_entries: List[str] = []
189
189
  self.step_counter = 0
190
190
 
191
191
  logger.info(f"📝 Logs capture ENABLED - will save history logs periodically")
@@ -202,31 +202,18 @@ class LogsCapture:
202
202
  # Get history object from agent
203
203
  history = agent.history
204
204
 
205
- # Extract relevant information from history
206
- log_entry = {
207
- 'step': step_number,
208
- 'timestamp': datetime.now().isoformat(),
209
- 'urls': history.urls() if hasattr(history, 'urls') else [],
210
- 'action_names': history.action_names() if hasattr(history, 'action_names') else [],
211
- }
212
-
213
205
  # Extract model outputs if available
214
206
  try:
215
207
  model_outputs = history.model_outputs() if hasattr(history, 'model_outputs') else []
216
- log_entry['model_outputs'] = [
217
- {
218
- 'memory': h.current_state.memory if hasattr(h, 'current_state') else None,
219
- 'next_goal': h.current_state.next_goal if hasattr(h, 'current_state') else None,
220
- 'thinking': h.current_state.thinking if hasattr(h, 'current_state') else None,
221
- }
222
- for h in model_outputs
223
- ]
208
+ last_model_output = model_outputs[-1] if model_outputs else None
209
+ if hasattr(last_model_output, 'current_state'):
210
+ self.log_entries.append('💡 Thinking:\n' + last_model_output.current_state.thinking)
211
+ self.log_entries.append('🧠 Memory:\n' + last_model_output.current_state.memory)
212
+ self.log_entries.append('🎯 Next goal:\n' + last_model_output.current_state.next_goal)
224
213
  except Exception as e:
225
214
  logger.debug(f"Could not extract model outputs: {e}")
226
- log_entry['model_outputs'] = []
227
-
215
+
228
216
  # Add to accumulated logs
229
- self.log_entries.append(log_entry)
230
217
 
231
218
  # Upload to S3
232
219
  s3_key = f"{self.s3_prefix}{self.session_id}/operator.log"
@@ -285,12 +272,7 @@ def create_pydantic_model_from_schema(output_schema: Optional[List[Dict[str, Any
285
272
 
286
273
 
287
274
  async def main(session_id: str, cdp_url: str, task: str, output_schema_json: Optional[str] = None,
288
- <<<<<<< HEAD
289
- otp_secret: Optional[str] = None, screenshot_config: Optional[Dict[str, Any]] = None,
290
- logs_config: Optional[Dict[str, Any]] = None):
291
- =======
292
275
  otp_secret: Optional[str] = None, screenshot_config: Optional[Dict[str, Any]] = None, folder_path: str = None):
293
- >>>>>>> ec2-support
294
276
  llm = ChatOpenAI(
295
277
  model="gpt-4.1",
296
278
  api_key=os.getenv("OPENAI_API_KEY"),
@@ -434,20 +416,12 @@ if __name__ == '__main__':
434
416
  output_schema = payload.get('outputSchema')
435
417
  otp_secret = payload.get('otpSecret')
436
418
  screenshot_config = payload.get('screenshotConfig')
437
- <<<<<<< HEAD
438
- logs_config = payload.get('logsConfig')
439
- =======
440
419
  folder_path = payload.get('folderPath')
441
- >>>>>>> ec2-support
442
420
 
443
421
  if not session_id or not cdp_url or not task or not folder_path:
444
422
  raise SystemExit("Missing required fields in JSON payload: sessionId, cdpUrl, task, folderPath")
445
423
 
446
424
  output_schema_json = json.dumps(output_schema) if output_schema is not None else None
447
- <<<<<<< HEAD
448
- asyncio.run(main(session_id, cdp_url, task, output_schema_json, otp_secret, screenshot_config, logs_config))
449
- =======
450
425
  asyncio.run(main(session_id, cdp_url, task, output_schema_json, otp_secret, screenshot_config, folder_path))
451
- >>>>>>> ec2-support
452
426
  else:
453
427
  raise SystemExit("Usage: uv run executeBrowserTask.py; send a JSON payload via stdin")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minded-ai/mindedjs",
3
- "version": "1.0.0-ec2-beta-170",
3
+ "version": "1.0.0-ec2-beta-172",
4
4
  "description": "MindedJS is a TypeScript library for building agents.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -185,7 +185,7 @@ class LogsCapture:
185
185
  self.s3_client = self.boto3.client('s3', region_name=self.aws_region)
186
186
 
187
187
  # Track accumulated logs
188
- self.log_entries: List[Dict[str, Any]] = []
188
+ self.log_entries: List[str] = []
189
189
  self.step_counter = 0
190
190
 
191
191
  logger.info(f"📝 Logs capture ENABLED - will save history logs periodically")
@@ -202,31 +202,18 @@ class LogsCapture:
202
202
  # Get history object from agent
203
203
  history = agent.history
204
204
 
205
- # Extract relevant information from history
206
- log_entry = {
207
- 'step': step_number,
208
- 'timestamp': datetime.now().isoformat(),
209
- 'urls': history.urls() if hasattr(history, 'urls') else [],
210
- 'action_names': history.action_names() if hasattr(history, 'action_names') else [],
211
- }
212
-
213
205
  # Extract model outputs if available
214
206
  try:
215
207
  model_outputs = history.model_outputs() if hasattr(history, 'model_outputs') else []
216
- log_entry['model_outputs'] = [
217
- {
218
- 'memory': h.current_state.memory if hasattr(h, 'current_state') else None,
219
- 'next_goal': h.current_state.next_goal if hasattr(h, 'current_state') else None,
220
- 'thinking': h.current_state.thinking if hasattr(h, 'current_state') else None,
221
- }
222
- for h in model_outputs
223
- ]
208
+ last_model_output = model_outputs[-1] if model_outputs else None
209
+ if hasattr(last_model_output, 'current_state'):
210
+ self.log_entries.append('💡 Thinking:\n' + last_model_output.current_state.thinking)
211
+ self.log_entries.append('🧠 Memory:\n' + last_model_output.current_state.memory)
212
+ self.log_entries.append('🎯 Next goal:\n' + last_model_output.current_state.next_goal)
224
213
  except Exception as e:
225
214
  logger.debug(f"Could not extract model outputs: {e}")
226
- log_entry['model_outputs'] = []
227
-
215
+
228
216
  # Add to accumulated logs
229
- self.log_entries.append(log_entry)
230
217
 
231
218
  # Upload to S3
232
219
  s3_key = f"{self.s3_prefix}{self.session_id}/operator.log"
@@ -285,12 +272,7 @@ def create_pydantic_model_from_schema(output_schema: Optional[List[Dict[str, Any
285
272
 
286
273
 
287
274
  async def main(session_id: str, cdp_url: str, task: str, output_schema_json: Optional[str] = None,
288
- <<<<<<< HEAD
289
- otp_secret: Optional[str] = None, screenshot_config: Optional[Dict[str, Any]] = None,
290
- logs_config: Optional[Dict[str, Any]] = None):
291
- =======
292
275
  otp_secret: Optional[str] = None, screenshot_config: Optional[Dict[str, Any]] = None, folder_path: str = None):
293
- >>>>>>> ec2-support
294
276
  llm = ChatOpenAI(
295
277
  model="gpt-4.1",
296
278
  api_key=os.getenv("OPENAI_API_KEY"),
@@ -434,20 +416,12 @@ if __name__ == '__main__':
434
416
  output_schema = payload.get('outputSchema')
435
417
  otp_secret = payload.get('otpSecret')
436
418
  screenshot_config = payload.get('screenshotConfig')
437
- <<<<<<< HEAD
438
- logs_config = payload.get('logsConfig')
439
- =======
440
419
  folder_path = payload.get('folderPath')
441
- >>>>>>> ec2-support
442
420
 
443
421
  if not session_id or not cdp_url or not task or not folder_path:
444
422
  raise SystemExit("Missing required fields in JSON payload: sessionId, cdpUrl, task, folderPath")
445
423
 
446
424
  output_schema_json = json.dumps(output_schema) if output_schema is not None else None
447
- <<<<<<< HEAD
448
- asyncio.run(main(session_id, cdp_url, task, output_schema_json, otp_secret, screenshot_config, logs_config))
449
- =======
450
425
  asyncio.run(main(session_id, cdp_url, task, output_schema_json, otp_secret, screenshot_config, folder_path))
451
- >>>>>>> ec2-support
452
426
  else:
453
427
  raise SystemExit("Usage: uv run executeBrowserTask.py; send a JSON payload via stdin")