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.
- package/README.md +12 -2
- package/bin/explorbot-cli.ts +21 -21
- package/dist/bin/explorbot-cli.js +3 -3
- package/dist/package.json +4 -3
- package/dist/rules/researcher/container-rules.md +2 -0
- package/dist/src/action-result.js +2 -1
- package/dist/src/action.js +5 -10
- package/dist/src/ai/captain.js +0 -2
- package/dist/src/ai/driller.js +1108 -0
- package/dist/src/ai/historian/codeceptjs.js +2 -2
- package/dist/src/ai/historian/experience.js +1 -0
- package/dist/src/ai/historian/playwright.js +4 -4
- package/dist/src/ai/historian/screencast.js +121 -0
- package/dist/src/ai/historian.js +5 -3
- package/dist/src/ai/pilot.js +31 -22
- package/dist/src/ai/rules.js +3 -5
- package/dist/src/ai/session-analyst.js +117 -0
- package/dist/src/ai/tester.js +13 -2
- package/dist/src/commands/base-command.js +6 -6
- package/dist/src/commands/drill-command.js +3 -2
- package/dist/src/commands/exit-command.js +1 -0
- package/dist/src/commands/explore-command.js +20 -3
- package/dist/src/components/AddRule.js +1 -1
- package/dist/src/explorbot.js +52 -9
- package/dist/src/explorer.js +11 -9
- package/dist/src/reporter.js +68 -4
- package/dist/src/state-manager.js +4 -3
- package/dist/src/stats.js +5 -0
- package/dist/src/utils/aria.js +354 -529
- package/dist/src/utils/hooks-runner.js +2 -8
- package/dist/src/utils/html.js +371 -0
- package/dist/src/utils/strings.js +15 -0
- package/dist/src/utils/unique-names.js +12 -1
- package/dist/src/utils/url-matcher.js +6 -1
- package/dist/src/utils/web-element.js +27 -24
- package/dist/src/utils/xpath.js +1 -1
- package/package.json +4 -3
- package/rules/researcher/container-rules.md +2 -0
- package/src/action-result.ts +2 -1
- package/src/action.ts +5 -12
- package/src/ai/captain.ts +0 -2
- package/src/ai/driller.ts +1194 -0
- package/src/ai/historian/codeceptjs.ts +2 -2
- package/src/ai/historian/experience.ts +3 -2
- package/src/ai/historian/playwright.ts +5 -5
- package/src/ai/historian/screencast.ts +133 -0
- package/src/ai/historian.ts +7 -5
- package/src/ai/pilot.ts +31 -21
- package/src/ai/rules.ts +3 -5
- package/src/ai/session-analyst.ts +133 -0
- package/src/ai/tester.ts +15 -2
- package/src/commands/base-command.ts +6 -6
- package/src/commands/drill-command.ts +3 -2
- package/src/commands/exit-command.ts +1 -0
- package/src/commands/explore-command.ts +22 -3
- package/src/components/AddRule.tsx +1 -1
- package/src/config.ts +10 -0
- package/src/explorbot.ts +59 -11
- package/src/explorer.ts +11 -9
- package/src/reporter.ts +68 -4
- package/src/state-manager.ts +4 -3
- package/src/stats.ts +7 -0
- package/src/utils/aria.ts +367 -537
- package/src/utils/hooks-runner.ts +2 -6
- package/src/utils/html.ts +381 -0
- package/src/utils/strings.ts +17 -0
- package/src/utils/unique-names.ts +13 -0
- package/src/utils/url-matcher.ts +5 -1
- package/src/utils/web-element.ts +31 -28
- package/src/utils/xpath.ts +1 -1
- package/dist/src/ai/bosun.js +0 -456
- 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
|
}
|