explorbot 0.1.11 → 0.1.13

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 (72) hide show
  1. package/README.md +12 -2
  2. package/bin/explorbot-cli.ts +21 -21
  3. package/dist/bin/explorbot-cli.js +3 -3
  4. package/dist/package.json +4 -3
  5. package/dist/rules/researcher/container-rules.md +2 -0
  6. package/dist/src/action-result.js +2 -1
  7. package/dist/src/action.js +5 -10
  8. package/dist/src/ai/captain.js +0 -2
  9. package/dist/src/ai/driller.js +1108 -0
  10. package/dist/src/ai/historian/codeceptjs.js +2 -2
  11. package/dist/src/ai/historian/experience.js +1 -0
  12. package/dist/src/ai/historian/playwright.js +4 -4
  13. package/dist/src/ai/historian/screencast.js +121 -0
  14. package/dist/src/ai/historian.js +5 -3
  15. package/dist/src/ai/pilot.js +31 -22
  16. package/dist/src/ai/rules.js +3 -5
  17. package/dist/src/ai/session-analyst.js +117 -0
  18. package/dist/src/ai/tester.js +13 -2
  19. package/dist/src/commands/base-command.js +6 -6
  20. package/dist/src/commands/drill-command.js +3 -2
  21. package/dist/src/commands/exit-command.js +1 -0
  22. package/dist/src/commands/explore-command.js +20 -3
  23. package/dist/src/components/AddRule.js +1 -1
  24. package/dist/src/explorbot.js +52 -9
  25. package/dist/src/explorer.js +11 -9
  26. package/dist/src/reporter.js +68 -4
  27. package/dist/src/state-manager.js +4 -3
  28. package/dist/src/stats.js +5 -0
  29. package/dist/src/utils/aria.js +354 -529
  30. package/dist/src/utils/hooks-runner.js +2 -8
  31. package/dist/src/utils/html.js +371 -0
  32. package/dist/src/utils/strings.js +15 -0
  33. package/dist/src/utils/unique-names.js +12 -1
  34. package/dist/src/utils/url-matcher.js +6 -1
  35. package/dist/src/utils/web-element.js +27 -24
  36. package/dist/src/utils/xpath.js +1 -1
  37. package/package.json +4 -3
  38. package/rules/researcher/container-rules.md +2 -0
  39. package/src/action-result.ts +2 -1
  40. package/src/action.ts +5 -12
  41. package/src/ai/captain.ts +0 -2
  42. package/src/ai/driller.ts +1194 -0
  43. package/src/ai/historian/codeceptjs.ts +2 -2
  44. package/src/ai/historian/experience.ts +3 -2
  45. package/src/ai/historian/playwright.ts +5 -5
  46. package/src/ai/historian/screencast.ts +133 -0
  47. package/src/ai/historian.ts +7 -5
  48. package/src/ai/pilot.ts +31 -21
  49. package/src/ai/rules.ts +3 -5
  50. package/src/ai/session-analyst.ts +133 -0
  51. package/src/ai/tester.ts +15 -2
  52. package/src/commands/base-command.ts +6 -6
  53. package/src/commands/drill-command.ts +3 -2
  54. package/src/commands/exit-command.ts +1 -0
  55. package/src/commands/explore-command.ts +22 -3
  56. package/src/components/AddRule.tsx +1 -1
  57. package/src/config.ts +10 -0
  58. package/src/explorbot.ts +59 -11
  59. package/src/explorer.ts +11 -9
  60. package/src/reporter.ts +68 -4
  61. package/src/state-manager.ts +4 -3
  62. package/src/stats.ts +7 -0
  63. package/src/utils/aria.ts +367 -537
  64. package/src/utils/hooks-runner.ts +2 -6
  65. package/src/utils/html.ts +381 -0
  66. package/src/utils/strings.ts +17 -0
  67. package/src/utils/unique-names.ts +13 -0
  68. package/src/utils/url-matcher.ts +5 -1
  69. package/src/utils/web-element.ts +31 -28
  70. package/src/utils/xpath.ts +1 -1
  71. package/dist/src/ai/bosun.js +0 -456
  72. package/src/ai/bosun.ts +0 -571
package/src/action.ts CHANGED
@@ -21,6 +21,7 @@ import type { StateManager } from './state-manager.js';
21
21
  import { extractCodeBlocks } from './utils/code-extractor.js';
22
22
  import { htmlCombinedSnapshot, minifyHtml } from './utils/html.js';
23
23
  import { createDebug, log, setStepSpanParent, tag } from './utils/logger.js';
24
+ import { safeFilename } from './utils/strings.ts';
24
25
  import { throttle } from './utils/throttle.ts';
25
26
 
26
27
  const debugLog = createDebug('explorbot:action');
@@ -89,7 +90,7 @@ class Action {
89
90
  let screenshotFile: string | undefined = undefined;
90
91
 
91
92
  if (includeScreenshot) {
92
- const filename = `${stateHash}_${timestamp}.png`;
93
+ const filename = safeFilename(`${stateHash}_${timestamp}`, '.png');
93
94
  screenshotFile = await (this.actor as any)
94
95
  .saveScreenshot(filename)
95
96
  .then(() => filename)
@@ -102,13 +103,13 @@ class Action {
102
103
  // Save HTML to file
103
104
  const statesDir = outputPath('states');
104
105
  fs.mkdirSync(statesDir, { recursive: true });
105
- const htmlFile = `${stateHash}_${timestamp}.html`;
106
+ const htmlFile = safeFilename(`${stateHash}_${timestamp}`, '.html');
106
107
  const htmlPath = join(statesDir, htmlFile);
107
108
  fs.writeFileSync(htmlPath, html, 'utf8');
108
109
 
109
110
  debugLog('Captured page state');
110
111
  // Save logs to file
111
- const logFile = `${stateHash}_${timestamp}.log`;
112
+ const logFile = safeFilename(`${stateHash}_${timestamp}`, '.log');
112
113
  const logPath = join(statesDir, logFile);
113
114
  const formattedLogs = browserLogs.map((log: any) => {
114
115
  const logTimestamp = new Date().toISOString();
@@ -134,7 +135,7 @@ class Action {
134
135
  }
135
136
 
136
137
  if (ariaSnapshot) {
137
- const ariaFileName = `${stateHash}_${timestamp}.aria.yaml`;
138
+ const ariaFileName = safeFilename(`${stateHash}_${timestamp}`, '.aria.yaml');
138
139
  const ariaPath = join(statesDir, ariaFileName);
139
140
  fs.writeFileSync(ariaPath, ariaSnapshot, 'utf8');
140
141
  ariaSnapshotFile = ariaFileName;
@@ -368,14 +369,6 @@ class Action {
368
369
  return true;
369
370
  } catch (error) {
370
371
  this.lastError = error as Error;
371
-
372
- if (error && typeof error === 'object') {
373
- const errorObj = error as { fetchDetails?: () => Promise<void> };
374
- if (typeof errorObj.fetchDetails === 'function') {
375
- await errorObj.fetchDetails();
376
- }
377
- }
378
-
379
372
  debugLog(`Attempt failed: ${codeBlock}: ${errorToString(error) || this.lastError?.toString()}`);
380
373
  return false;
381
374
  }
package/src/ai/captain.ts CHANGED
@@ -196,8 +196,6 @@ export class Captain extends CaptainBase implements Agent {
196
196
  ${knowledge}
197
197
 
198
198
  ${experience}
199
-
200
- Use runCommand("/research") if you need deeper page understanding or UI element mapping.
201
199
  `;
202
200
  }
203
201