explorbot 0.1.31 → 0.2.0
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 +14 -14
- package/bin/explorbot-cli.ts +4 -3
- package/boat/doc-collector/src/ai/documentarian.ts +22 -27
- package/boat/doc-collector/src/ai/tools.ts +67 -10
- package/boat/doc-collector/src/docbot.ts +28 -7
- package/boat/doc-collector/src/docs-renderer.ts +19 -24
- package/boat/doc-collector/src/screenshots.ts +33 -1
- package/boat/doc-collector/src/state-diagram.ts +281 -0
- package/dist/bin/explorbot-cli.js +3 -3
- package/dist/boat/doc-collector/src/ai/documentarian.js +16 -6
- package/dist/boat/doc-collector/src/ai/tools.js +47 -10
- package/dist/boat/doc-collector/src/docbot.js +25 -6
- package/dist/boat/doc-collector/src/docs-renderer.js +18 -3
- package/dist/boat/doc-collector/src/screenshots.js +29 -0
- package/dist/boat/doc-collector/src/state-diagram.js +200 -0
- package/dist/package.json +8 -6
- package/dist/src/action-result.d.ts +131 -0
- package/dist/src/action-result.js +82 -159
- package/dist/src/action.d.ts +43 -0
- package/dist/src/action.js +18 -106
- package/dist/src/activity.d.ts +26 -0
- package/dist/src/ai/agent.d.ts +3 -0
- package/dist/src/ai/captain/file-tools.d.ts +28 -0
- package/dist/src/ai/captain/idle-mode.d.ts +11 -0
- package/dist/src/ai/captain/mixin.d.ts +10 -0
- package/dist/src/ai/captain/test-mode.d.ts +13 -0
- package/dist/src/ai/captain/web-mode.d.ts +13 -0
- package/dist/src/ai/captain/web-mode.js +0 -7
- package/dist/src/ai/captain.d.ts +141 -0
- package/dist/src/ai/captain.js +4 -19
- package/dist/src/ai/conversation.d.ts +28 -0
- package/dist/src/ai/conversation.js +9 -28
- package/dist/src/ai/driller.d.ts +157 -0
- package/dist/src/ai/driller.js +3 -12
- package/dist/src/ai/experience-compactor.d.ts +53 -0
- package/dist/src/ai/experience-compactor.js +16 -33
- package/dist/src/ai/fisherman-tools.d.ts +90 -0
- package/dist/src/ai/fisherman-tools.js +1 -1
- package/dist/src/ai/fisherman.d.ts +29 -0
- package/dist/src/ai/fisherman.js +0 -3
- package/dist/src/ai/historian/codeceptjs.d.ts +17 -0
- package/dist/src/ai/historian/codeceptjs.js +3 -2
- package/dist/src/ai/historian/experience.d.ts +40 -0
- package/dist/src/ai/historian/mixin.d.ts +2 -0
- package/dist/src/ai/historian/playwright.d.ts +22 -0
- package/dist/src/ai/historian/playwright.js +3 -2
- package/dist/src/ai/historian/screencast.d.ts +32 -0
- package/dist/src/ai/historian/utils.d.ts +3 -0
- package/dist/src/ai/historian/utils.js +0 -1
- package/dist/src/ai/historian.d.ts +109 -0
- package/dist/src/ai/historian.js +1 -5
- package/dist/src/ai/navigator.d.ts +54 -0
- package/dist/src/ai/navigator.js +11 -46
- package/dist/src/ai/pilot.d.ts +81 -0
- package/dist/src/ai/pilot.js +6 -17
- package/dist/src/ai/planner/session-dedup.d.ts +12 -0
- package/dist/src/ai/planner/styles.d.ts +6 -0
- package/dist/src/ai/planner/subpages.d.ts +35 -0
- package/dist/src/ai/planner.d.ts +79 -0
- package/dist/src/ai/planner.js +49 -37
- package/dist/src/ai/provider.d.ts +53 -0
- package/dist/src/ai/provider.js +78 -130
- package/dist/src/ai/quartermaster.d.ts +56 -0
- package/dist/src/ai/quartermaster.js +4 -10
- package/dist/src/ai/rerunner.d.ts +48 -0
- package/dist/src/ai/rerunner.js +14 -22
- package/dist/src/ai/researcher/cache.d.ts +6 -0
- package/dist/src/ai/researcher/cache.js +11 -18
- package/dist/src/ai/researcher/coordinates.d.ts +56 -0
- package/dist/src/ai/researcher/deep-analysis.d.ts +74 -0
- package/dist/src/ai/researcher/deep-analysis.js +3 -6
- package/dist/src/ai/researcher/fingerprint-worker.d.ts +1 -0
- package/dist/src/ai/researcher/focus.d.ts +8 -0
- package/dist/src/ai/researcher/locators.d.ts +36 -0
- package/dist/src/ai/researcher/mixin.d.ts +2 -0
- package/dist/src/ai/researcher/parser.d.ts +35 -0
- package/dist/src/ai/researcher/parser.js +1 -1
- package/dist/src/ai/researcher/research-result.d.ts +15 -0
- package/dist/src/ai/researcher/research-result.js +0 -19
- package/dist/src/ai/researcher/sections.d.ts +19 -0
- package/dist/src/ai/researcher/sections.js +5 -1
- package/dist/src/ai/researcher.js +12 -53
- package/dist/src/ai/rules.d.ts +16 -0
- package/dist/src/ai/rules.js +22 -15
- package/dist/src/ai/session-analyst.d.ts +11 -0
- package/dist/src/ai/session-analyst.js +8 -5
- package/dist/src/ai/task-agent.d.ts +28 -0
- package/dist/src/ai/task-agent.js +2 -27
- package/dist/src/ai/tester.d.ts +101 -0
- package/dist/src/ai/tester.js +10 -61
- package/dist/src/ai/tools.d.ts +52 -0
- package/dist/src/ai/tools.js +119 -101
- package/dist/src/api/api-client.d.ts +17 -0
- package/dist/src/api/request-result.d.ts +44 -0
- package/dist/src/api/request-store.d.ts +29 -0
- package/dist/src/api/spec-reader.d.ts +5 -0
- package/dist/src/api/xhr-capture.d.ts +10 -0
- package/dist/src/browser-server.d.ts +10 -0
- package/dist/src/command-handler.d.ts +68 -0
- package/dist/src/commands/add-rule-command.d.ts +11 -0
- package/dist/src/commands/base-command.d.ts +26 -0
- package/dist/src/commands/clean-command.d.ts +12 -0
- package/dist/src/commands/compact-command.d.ts +20 -0
- package/dist/src/commands/compact-command.js +6 -6
- package/dist/src/commands/context-aria-command.d.ts +6 -0
- package/dist/src/commands/context-command.d.ts +11 -0
- package/dist/src/commands/context-command.js +1 -1
- package/dist/src/commands/context-data-command.d.ts +6 -0
- package/dist/src/commands/context-experience-command.d.ts +6 -0
- package/dist/src/commands/context-html-command.d.ts +6 -0
- package/dist/src/commands/context-knowledge-command.d.ts +6 -0
- package/dist/src/commands/context-knowledge-command.js +1 -1
- package/dist/src/commands/debug-command.d.ts +6 -0
- package/dist/src/commands/drill-command.d.ts +10 -0
- package/dist/src/commands/exit-command.d.ts +7 -0
- package/dist/src/commands/experience-command.d.ts +15 -0
- package/dist/src/commands/experience-command.js +1 -1
- package/dist/src/commands/explore-command.d.ts +51 -0
- package/dist/src/commands/freesail-command.d.ts +12 -0
- package/dist/src/commands/help-command.d.ts +6 -0
- package/dist/src/commands/index.d.ts +4 -0
- package/dist/src/commands/init-command.d.ts +7 -0
- package/dist/src/commands/knows-command.d.ts +10 -0
- package/dist/src/commands/knows-command.js +1 -1
- package/dist/src/commands/learn-command.d.ts +7 -0
- package/dist/src/commands/learn-command.js +3 -1
- package/dist/src/commands/navigate-command.d.ts +7 -0
- package/dist/src/commands/path-command.d.ts +10 -0
- package/dist/src/commands/plan-clear-command.d.ts +7 -0
- package/dist/src/commands/plan-command.d.ts +14 -0
- package/dist/src/commands/plan-edit-command.d.ts +7 -0
- package/dist/src/commands/plan-load-command.d.ts +7 -0
- package/dist/src/commands/plan-reload-command.d.ts +7 -0
- package/dist/src/commands/plan-save-command.d.ts +7 -0
- package/dist/src/commands/plans-command.d.ts +21 -0
- package/dist/src/commands/rerun-command.d.ts +7 -0
- package/dist/src/commands/research-command.d.ts +11 -0
- package/dist/src/commands/runs-command.d.ts +7 -0
- package/dist/src/commands/start-command.d.ts +7 -0
- package/dist/src/commands/status-command.d.ts +6 -0
- package/dist/src/commands/test-command.d.ts +11 -0
- package/dist/src/components/ActivityPane.d.ts +6 -0
- package/dist/src/components/AddKnowledge.d.ts +10 -0
- package/dist/src/components/AddKnowledge.js +3 -7
- package/dist/src/components/AddRule.d.ts +9 -0
- package/dist/src/components/App.d.ts +9 -0
- package/dist/src/components/App.js +2 -2
- package/dist/src/components/Autocomplete.d.ts +3 -0
- package/dist/src/components/InputPane.d.ts +13 -0
- package/dist/src/components/InputReadline.d.ts +17 -0
- package/dist/src/components/LogPane.d.ts +6 -0
- package/dist/src/components/PlanEditor.d.ts +9 -0
- package/dist/src/components/PlanPane.d.ts +13 -0
- package/dist/src/components/SessionTimer.d.ts +6 -0
- package/dist/src/components/StateTransitionPane.d.ts +8 -0
- package/dist/src/components/StatusPane.d.ts +4 -0
- package/dist/src/components/TaskPane.d.ts +9 -0
- package/dist/src/components/Welcome.d.ts +3 -0
- package/dist/src/components/WelcomeChecklist.d.ts +9 -0
- package/dist/src/components/WelcomeCommands.d.ts +6 -0
- package/dist/src/components/autocomplete-store.d.ts +10 -0
- package/dist/src/components/parse-keypress.d.ts +12 -0
- package/dist/src/config.d.ts +253 -0
- package/dist/src/config.js +12 -0
- package/dist/src/execution-controller.d.ts +25 -0
- package/dist/src/experience-tracker.d.ts +112 -0
- package/dist/src/experience-tracker.js +83 -155
- package/dist/src/explorbot.d.ts +106 -0
- package/dist/src/explorbot.js +17 -51
- package/dist/src/explorer.d.ts +129 -0
- package/dist/src/explorer.js +31 -77
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +2 -55
- package/dist/src/knowledge-tracker.d.ts +33 -0
- package/dist/src/knowledge-tracker.js +47 -47
- package/dist/src/observability.d.ts +13 -0
- package/dist/src/observability.js +2 -1
- package/dist/src/playwright-recorder.d.ts +31 -0
- package/dist/src/reporter.d.ts +34 -0
- package/dist/src/state-manager.d.ts +160 -0
- package/dist/src/state-manager.js +10 -136
- package/dist/src/stats.d.ts +24 -0
- package/dist/src/suite.d.ts +24 -0
- package/dist/src/test-plan.d.ts +166 -0
- package/dist/src/utils/aria.d.ts +25 -0
- package/dist/src/utils/aria.js +4 -1
- package/dist/src/utils/browser-errors.d.ts +8 -0
- package/dist/src/utils/cache.d.ts +15 -0
- package/dist/src/utils/cache.js +34 -0
- package/dist/src/utils/cli-name.d.ts +1 -0
- package/dist/src/utils/code-extractor.d.ts +1 -0
- package/dist/src/utils/context-formatter.d.ts +31 -0
- package/dist/src/utils/context-formatter.js +15 -27
- package/dist/src/utils/error-page.d.ts +12 -0
- package/dist/src/utils/expandable.d.ts +4 -0
- package/dist/src/utils/hooks-runner.d.ts +15 -0
- package/dist/src/utils/html-diff.d.ts +19 -0
- package/dist/src/utils/html.d.ts +129 -0
- package/dist/src/utils/html.js +71 -0
- package/dist/src/utils/log-filters.d.ts +6 -0
- package/dist/src/utils/logger.d.ts +35 -0
- package/dist/src/utils/loop.d.ts +35 -0
- package/dist/src/utils/markdown-files.d.ts +10 -0
- package/dist/src/utils/markdown-files.js +21 -0
- package/dist/src/utils/markdown-parser.d.ts +17 -0
- package/dist/src/utils/markdown-query.d.ts +46 -0
- package/dist/src/utils/markdown-query.js +14 -1
- package/dist/src/utils/markdown-terminal.d.ts +1 -0
- package/dist/src/utils/next-steps.d.ts +11 -0
- package/dist/src/utils/page-readiness.d.ts +7 -0
- package/dist/src/utils/page-readiness.js +1 -1
- package/dist/src/utils/research-parser.d.ts +1 -0
- package/dist/src/utils/retry.d.ts +8 -0
- package/dist/src/utils/rules-loader.d.ts +12 -0
- package/dist/src/utils/secrets.d.ts +4 -0
- package/dist/src/utils/secrets.js +28 -0
- package/dist/src/utils/step-analyzer.d.ts +11 -0
- package/dist/src/utils/strings.d.ts +5 -0
- package/dist/src/utils/strings.js +10 -0
- package/dist/src/utils/test-files.d.ts +3 -0
- package/dist/src/utils/test-plan-markdown.d.ts +9 -0
- package/dist/src/utils/throttle.d.ts +2 -0
- package/dist/src/utils/unique-names.d.ts +2 -0
- package/dist/src/utils/url-matcher.d.ts +6 -0
- package/dist/src/utils/web-element.d.ts +45 -0
- package/dist/src/utils/web-element.js +3 -0
- package/dist/src/utils/web-sandbox.d.ts +4 -0
- package/dist/src/utils/web-sandbox.js +37 -0
- package/dist/src/utils/xpath.d.ts +17 -0
- package/package.json +8 -6
- package/src/action-result.ts +80 -168
- package/src/action.ts +16 -123
- package/src/ai/captain/web-mode.ts +0 -7
- package/src/ai/captain.ts +5 -17
- package/src/ai/conversation.ts +9 -32
- package/src/ai/driller.ts +3 -16
- package/src/ai/experience-compactor.ts +16 -35
- package/src/ai/fisherman-tools.ts +1 -1
- package/src/ai/fisherman.ts +0 -4
- package/src/ai/historian/codeceptjs.ts +4 -2
- package/src/ai/historian/playwright.ts +4 -2
- package/src/ai/historian/utils.ts +0 -1
- package/src/ai/historian.ts +4 -7
- package/src/ai/navigator.ts +13 -49
- package/src/ai/pilot.ts +6 -16
- package/src/ai/planner.ts +56 -44
- package/src/ai/provider.ts +86 -139
- package/src/ai/quartermaster.ts +34 -41
- package/src/ai/rerunner.ts +17 -21
- package/src/ai/researcher/cache.ts +10 -16
- package/src/ai/researcher/deep-analysis.ts +3 -6
- package/src/ai/researcher/parser.ts +1 -1
- package/src/ai/researcher/research-result.ts +0 -18
- package/src/ai/researcher/sections.ts +5 -1
- package/src/ai/researcher.ts +11 -59
- package/src/ai/rules.ts +24 -13
- package/src/ai/session-analyst.ts +8 -5
- package/src/ai/task-agent.ts +3 -30
- package/src/ai/tester.ts +12 -73
- package/src/ai/tools.ts +119 -106
- package/src/commands/compact-command.ts +7 -8
- package/src/commands/context-command.ts +1 -1
- package/src/commands/context-knowledge-command.ts +1 -1
- package/src/commands/experience-command.ts +1 -1
- package/src/commands/knows-command.ts +1 -1
- package/src/commands/learn-command.ts +3 -1
- package/src/components/AddKnowledge.tsx +5 -7
- package/src/components/App.tsx +2 -2
- package/src/config.ts +12 -0
- package/src/experience-tracker.ts +90 -152
- package/src/explorbot.ts +17 -51
- package/src/explorer.ts +34 -81
- package/src/index.ts +9 -0
- package/src/knowledge-tracker.ts +49 -50
- package/src/observability.ts +2 -1
- package/src/state-manager.ts +15 -164
- package/src/utils/aria.ts +11 -2
- package/src/utils/cache.ts +40 -0
- package/src/utils/context-formatter.ts +12 -15
- package/src/utils/html.ts +79 -0
- package/src/utils/markdown-files.ts +30 -0
- package/src/utils/markdown-query.ts +15 -1
- package/src/utils/page-readiness.ts +1 -1
- package/src/utils/secrets.ts +28 -0
- package/src/utils/strings.ts +12 -0
- package/src/utils/web-element.ts +4 -0
- package/src/utils/web-sandbox.ts +43 -0
- package/src/index.tsx +0 -62
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ExplorbotConfig } from '../../config.js';
|
|
2
|
+
import type { PlaywrightRecorder } from '../../playwright-recorder.js';
|
|
3
|
+
import { type Constructor } from './mixin.js';
|
|
4
|
+
export interface ScreencastMethods {
|
|
5
|
+
attachScreencast(): void;
|
|
6
|
+
isScreencastActive(): boolean;
|
|
7
|
+
stopScreencast(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare function WithScreencast<T extends Constructor>(Base: T): {
|
|
10
|
+
new (...args: any[]): {
|
|
11
|
+
config: ExplorbotConfig | undefined;
|
|
12
|
+
savedFiles: Set<string>;
|
|
13
|
+
playwright: {
|
|
14
|
+
recorder: PlaywrightRecorder;
|
|
15
|
+
helper: any;
|
|
16
|
+
} | undefined;
|
|
17
|
+
screencastPage: any;
|
|
18
|
+
screencastActive: boolean;
|
|
19
|
+
screencastPath: string | null;
|
|
20
|
+
screencastListenersInstalled: boolean;
|
|
21
|
+
screencastTask: any;
|
|
22
|
+
screencastLastChapter: string | null;
|
|
23
|
+
onTestBefore?: (test: any) => void;
|
|
24
|
+
onStepPassed?: (step: any) => void;
|
|
25
|
+
onTestAfter?: () => void;
|
|
26
|
+
isScreencastActive(): boolean;
|
|
27
|
+
attachScreencast(): void;
|
|
28
|
+
startScreencast(test: any): Promise<void>;
|
|
29
|
+
emitChapter(_step: any): Promise<void>;
|
|
30
|
+
stopScreencast(): Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
} & T;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { ExplorbotConfig } from '../config.js';
|
|
2
|
+
import type { ExperienceTracker } from '../experience-tracker.js';
|
|
3
|
+
import type { PlaywrightRecorder } from '../playwright-recorder.js';
|
|
4
|
+
import type { Reporter } from '../reporter.js';
|
|
5
|
+
import type { StateManager } from '../state-manager.js';
|
|
6
|
+
import type { Plan } from '../test-plan.js';
|
|
7
|
+
import { type CodeceptJSMethods } from './historian/codeceptjs.js';
|
|
8
|
+
import { type ExperienceMethods } from './historian/experience.js';
|
|
9
|
+
import { type PlaywrightMethods } from './historian/playwright.js';
|
|
10
|
+
import { type ScreencastMethods } from './historian/screencast.js';
|
|
11
|
+
import type { Provider } from './provider.js';
|
|
12
|
+
declare const HistorianBase: {
|
|
13
|
+
new (...args: any[]): {
|
|
14
|
+
config: ExplorbotConfig | undefined;
|
|
15
|
+
savedFiles: Set<string>;
|
|
16
|
+
playwright: {
|
|
17
|
+
recorder: PlaywrightRecorder;
|
|
18
|
+
helper: any;
|
|
19
|
+
};
|
|
20
|
+
screencastPage: any;
|
|
21
|
+
screencastActive: boolean;
|
|
22
|
+
screencastPath: string | null;
|
|
23
|
+
screencastListenersInstalled: boolean;
|
|
24
|
+
screencastTask: any;
|
|
25
|
+
screencastLastChapter: string | null;
|
|
26
|
+
onTestBefore?: (test: any) => void;
|
|
27
|
+
onStepPassed?: (step: any) => void;
|
|
28
|
+
onTestAfter?: () => void;
|
|
29
|
+
isScreencastActive(): boolean;
|
|
30
|
+
attachScreencast(): void;
|
|
31
|
+
startScreencast(test: any): Promise<void>;
|
|
32
|
+
emitChapter(_step: any): Promise<void>;
|
|
33
|
+
stopScreencast(): Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
} & {
|
|
36
|
+
new (...args: any[]): {
|
|
37
|
+
playwright: {
|
|
38
|
+
recorder: PlaywrightRecorder;
|
|
39
|
+
helper: any;
|
|
40
|
+
};
|
|
41
|
+
savedFiles: Set<string>;
|
|
42
|
+
stateManager?: StateManager;
|
|
43
|
+
toPlaywrightCode(conversation: import("./conversation.js").Conversation, scenario: string): Promise<string>;
|
|
44
|
+
savePlaywrightPlanToFile(plan: Plan): string;
|
|
45
|
+
getPlaywrightKnowledgeLines(url: string, indent?: string): string[];
|
|
46
|
+
};
|
|
47
|
+
} & {
|
|
48
|
+
new (...args: any[]): {
|
|
49
|
+
savedFiles: Set<string>;
|
|
50
|
+
stateManager?: StateManager;
|
|
51
|
+
toCode(conversation: import("./conversation.js").Conversation, scenario: string): string;
|
|
52
|
+
saveCodeceptPlanToFile(plan: Plan): string;
|
|
53
|
+
getKnowledgeLines(url: string, indent?: string): string[];
|
|
54
|
+
};
|
|
55
|
+
} & {
|
|
56
|
+
new (...args: any[]): {
|
|
57
|
+
provider: Provider;
|
|
58
|
+
experienceTracker: ExperienceTracker;
|
|
59
|
+
reporter: Reporter | undefined;
|
|
60
|
+
stateManager: StateManager | undefined;
|
|
61
|
+
isPlaywrightFramework: () => boolean;
|
|
62
|
+
toCode: (conversation: import("./conversation.js").Conversation, scenario: string) => string;
|
|
63
|
+
toPlaywrightCode: (conversation: import("./conversation.js").Conversation, scenario: string) => Promise<string>;
|
|
64
|
+
stopScreencast: () => Promise<void>;
|
|
65
|
+
saveSession(task: import("../test-plan.js").Task, initialState: import("../action-result.js").ActionResult, conversation: import("./conversation.js").Conversation): Promise<void>;
|
|
66
|
+
reportSession(test: import("../test-plan.js").Test, steps: import("../experience-tracker.js").SessionStep[]): Promise<void>;
|
|
67
|
+
extractSteps(toolExecutions: import("./conversation.js").ToolExecution[]): Promise<import("../experience-tracker.js").SessionStep[]>;
|
|
68
|
+
hasRelevantFlowExperience(state: import("../action-result.js").ActionResult): boolean;
|
|
69
|
+
extractPassedCodeceptSteps(task: import("../test-plan.js").Task): import("../experience-tracker.js").SessionStep[];
|
|
70
|
+
curateFlow(steps: import("../experience-tracker.js").SessionStep[], task: import("../test-plan.js").Task, initialState: import("../action-result.js").ActionResult): Promise<string>;
|
|
71
|
+
renderFlowFromSuccessfulSteps(steps: import("../experience-tracker.js").SessionStep[], task: import("../test-plan.js").Task): string;
|
|
72
|
+
detectRetryPatterns(toolExecutions: import("./conversation.js").ToolExecution[], initialState: import("../action-result.js").ActionResult): Promise<void>;
|
|
73
|
+
analyzeDiscoveries(stepsWithDiffs: {
|
|
74
|
+
step: import("../experience-tracker.js").SessionStep;
|
|
75
|
+
ariaDiff: string | null;
|
|
76
|
+
}[]): Promise<void>;
|
|
77
|
+
buildDiscoveryPrompt(stepsWithDiffs: {
|
|
78
|
+
step: import("../experience-tracker.js").SessionStep;
|
|
79
|
+
ariaDiff: string | null;
|
|
80
|
+
}[]): string;
|
|
81
|
+
extractVisitedUrls(toolExecutions: import("./conversation.js").ToolExecution[], initialUrl: string): string[];
|
|
82
|
+
};
|
|
83
|
+
} & (new (...args: any[]) => object);
|
|
84
|
+
export interface Historian extends ExperienceMethods, CodeceptJSMethods, PlaywrightMethods, ScreencastMethods {
|
|
85
|
+
}
|
|
86
|
+
export declare class Historian extends HistorianBase {
|
|
87
|
+
provider: Provider;
|
|
88
|
+
experienceTracker: ExperienceTracker;
|
|
89
|
+
reporter: Reporter | undefined;
|
|
90
|
+
stateManager: StateManager | undefined;
|
|
91
|
+
config: ExplorbotConfig | undefined;
|
|
92
|
+
playwright: {
|
|
93
|
+
recorder: PlaywrightRecorder;
|
|
94
|
+
helper: any;
|
|
95
|
+
} | undefined;
|
|
96
|
+
savedFiles: Set<string>;
|
|
97
|
+
constructor(provider: Provider, experienceTracker: ExperienceTracker, reporter?: Reporter, stateManager?: StateManager, config?: ExplorbotConfig, playwright?: {
|
|
98
|
+
recorder: PlaywrightRecorder;
|
|
99
|
+
helper: any;
|
|
100
|
+
});
|
|
101
|
+
isPlaywrightFramework(): boolean;
|
|
102
|
+
getSavedFiles(): string[];
|
|
103
|
+
savePlanToFile(plan: Plan): string;
|
|
104
|
+
rewriteScenarioInFile(filePath: string, healedSteps: Array<{
|
|
105
|
+
original: string;
|
|
106
|
+
healed: string;
|
|
107
|
+
}>): void;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
package/dist/src/ai/historian.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { ExperienceTracker } from "../experience-tracker.js";
|
|
3
2
|
import { tag } from "../utils/logger.js";
|
|
4
3
|
import { relativeToCwd } from "../utils/next-steps.js";
|
|
5
4
|
import { WithCodeceptJS } from "./historian/codeceptjs.js";
|
|
6
5
|
import { WithExperience } from "./historian/experience.js";
|
|
7
6
|
import { WithPlaywright } from "./historian/playwright.js";
|
|
8
7
|
import { WithScreencast } from "./historian/screencast.js";
|
|
9
|
-
export { isNonReusableCode } from "../utils/step-analyzer.js";
|
|
10
8
|
const HistorianBase = WithScreencast(WithPlaywright(WithCodeceptJS(WithExperience(Object))));
|
|
11
9
|
export class Historian extends HistorianBase {
|
|
12
10
|
constructor(provider, experienceTracker, reporter, stateManager, config, playwright) {
|
|
13
11
|
super();
|
|
14
12
|
this.provider = provider;
|
|
15
|
-
this.experienceTracker = experienceTracker
|
|
13
|
+
this.experienceTracker = experienceTracker;
|
|
16
14
|
this.reporter = reporter;
|
|
17
15
|
this.stateManager = stateManager;
|
|
18
16
|
this.config = config;
|
|
@@ -32,8 +30,6 @@ export class Historian extends HistorianBase {
|
|
|
32
30
|
rewriteScenarioInFile(filePath, healedSteps) {
|
|
33
31
|
let content = readFileSync(filePath, 'utf-8');
|
|
34
32
|
for (const step of healedSteps) {
|
|
35
|
-
if (!content.includes(step.original))
|
|
36
|
-
continue;
|
|
37
33
|
content = content.replace(step.original, step.healed);
|
|
38
34
|
}
|
|
39
35
|
writeFileSync(filePath, content);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ActionResult } from '../action-result.js';
|
|
2
|
+
import type Action from '../action.js';
|
|
3
|
+
import type { ExperienceTracker } from '../experience-tracker.js';
|
|
4
|
+
import Explorer from '../explorer.js';
|
|
5
|
+
import type { KnowledgeTracker } from '../knowledge-tracker.js';
|
|
6
|
+
import { HooksRunner } from '../utils/hooks-runner.js';
|
|
7
|
+
import type { Agent } from './agent.js';
|
|
8
|
+
import type { Provider } from './provider.js';
|
|
9
|
+
declare class Navigator implements Agent {
|
|
10
|
+
emoji: string;
|
|
11
|
+
provider: Provider;
|
|
12
|
+
knowledgeTracker: KnowledgeTracker;
|
|
13
|
+
experienceTracker: ExperienceTracker;
|
|
14
|
+
hooksRunner: HooksRunner;
|
|
15
|
+
MAX_ATTEMPTS: number;
|
|
16
|
+
systemPrompt: string;
|
|
17
|
+
freeSailSystemPrompt: string;
|
|
18
|
+
explorer: Explorer;
|
|
19
|
+
constructor(explorer: Explorer, provider: Provider);
|
|
20
|
+
get verifyAttempts(): number;
|
|
21
|
+
get verifyTimeout(): number;
|
|
22
|
+
getBaseOrigin(): string | null;
|
|
23
|
+
getComparableCurrentUrl(stateManager: any, expectedUrl: string): string;
|
|
24
|
+
isSameExpectedOrigin(expectedUrl: string, stateManager: any): boolean;
|
|
25
|
+
isOnExpectedPage(expectedUrl: string, stateManager: any): boolean;
|
|
26
|
+
visit(url: string): Promise<void>;
|
|
27
|
+
visitOnce(url: string): Promise<void>;
|
|
28
|
+
resolveState(message: string, actionResult: ActionResult, opts?: {
|
|
29
|
+
action?: Action;
|
|
30
|
+
expectedUrl?: string;
|
|
31
|
+
}): Promise<boolean>;
|
|
32
|
+
buildExperienceTools(): {
|
|
33
|
+
learnExperience: unknown;
|
|
34
|
+
} | undefined;
|
|
35
|
+
freeSail(opts?: {
|
|
36
|
+
strategy?: 'deep' | 'shallow';
|
|
37
|
+
scope?: string;
|
|
38
|
+
visitedUrls?: Set<string>;
|
|
39
|
+
}, actionResult?: ActionResult): Promise<{
|
|
40
|
+
target: string;
|
|
41
|
+
reason: string;
|
|
42
|
+
} | null>;
|
|
43
|
+
verifyState(message: string, actionResult: ActionResult): Promise<{
|
|
44
|
+
verified: boolean;
|
|
45
|
+
successfulCodes: string[];
|
|
46
|
+
assertionSteps: Array<{
|
|
47
|
+
name: string;
|
|
48
|
+
args: any[];
|
|
49
|
+
}>;
|
|
50
|
+
totalAttempted: number;
|
|
51
|
+
}>;
|
|
52
|
+
checkAlreadyVerified(aiResponse: string, actionResult: ActionResult): boolean;
|
|
53
|
+
}
|
|
54
|
+
export { Navigator };
|
package/dist/src/ai/navigator.js
CHANGED
|
@@ -2,8 +2,6 @@ import { tool } from 'ai';
|
|
|
2
2
|
import dedent from 'dedent';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ActionResult } from '../action-result.js';
|
|
5
|
-
import { ExperienceTracker, renderExperienceToc } from '../experience-tracker.js';
|
|
6
|
-
import { KnowledgeTracker } from '../knowledge-tracker.js';
|
|
7
5
|
import { normalizeUrl } from '../state-manager.js';
|
|
8
6
|
import { extractCodeBlocks } from '../utils/code-extractor.js';
|
|
9
7
|
import { HooksRunner } from "../utils/hooks-runner.js";
|
|
@@ -14,12 +12,11 @@ import { extractStatePath } from '../utils/url-matcher.js';
|
|
|
14
12
|
import { Researcher } from "./researcher.js";
|
|
15
13
|
import { actionRule, locatorRule, unexpectedPopupRule } from './rules.js';
|
|
16
14
|
import { isInteractive } from './task-agent.js';
|
|
17
|
-
import {
|
|
15
|
+
import { createLearnExperienceTool } from "./tools.js";
|
|
18
16
|
const debugLog = createDebug('explorbot:navigator');
|
|
19
17
|
class Navigator {
|
|
20
18
|
emoji = '🧭';
|
|
21
19
|
provider;
|
|
22
|
-
experienceCompactor;
|
|
23
20
|
knowledgeTracker;
|
|
24
21
|
experienceTracker;
|
|
25
22
|
hooksRunner;
|
|
@@ -62,12 +59,11 @@ class Navigator {
|
|
|
62
59
|
</rules>
|
|
63
60
|
`;
|
|
64
61
|
explorer;
|
|
65
|
-
constructor(explorer, provider
|
|
62
|
+
constructor(explorer, provider) {
|
|
66
63
|
this.provider = provider;
|
|
67
64
|
this.explorer = explorer;
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.experienceTracker = experienceTracker || new ExperienceTracker();
|
|
65
|
+
this.knowledgeTracker = explorer.getKnowledgeTracker();
|
|
66
|
+
this.experienceTracker = explorer.getStateManager().getExperienceTracker();
|
|
71
67
|
this.hooksRunner = new HooksRunner(explorer, explorer.getConfig());
|
|
72
68
|
}
|
|
73
69
|
get verifyAttempts() {
|
|
@@ -171,17 +167,8 @@ class Navigator {
|
|
|
171
167
|
debugLog('Resolution message:', message);
|
|
172
168
|
const action = opts?.action ?? this.explorer.createAction();
|
|
173
169
|
const expectedUrl = opts?.expectedUrl;
|
|
174
|
-
|
|
170
|
+
const knowledge = this.knowledgeTracker.renderRelevantKnowledge(actionResult);
|
|
175
171
|
let experience = '';
|
|
176
|
-
const relevantKnowledge = this.knowledgeTracker.getRelevantKnowledge(actionResult);
|
|
177
|
-
if (relevantKnowledge.length > 0) {
|
|
178
|
-
const knowledgeContent = relevantKnowledge.map((k) => k.content).join('\n\n');
|
|
179
|
-
knowledge = `
|
|
180
|
-
<hint>
|
|
181
|
-
Here is relevant knowledge for this page:
|
|
182
|
-
${knowledgeContent}
|
|
183
|
-
</hint>`;
|
|
184
|
-
}
|
|
185
172
|
if (!actionResult.isInsideIframe) {
|
|
186
173
|
const successful = this.experienceTracker.getSuccessfulExperience(actionResult);
|
|
187
174
|
if (successful.length > 0) {
|
|
@@ -362,7 +349,6 @@ class Navigator {
|
|
|
362
349
|
if (freshState.getStateHash() !== prevHash) {
|
|
363
350
|
try {
|
|
364
351
|
const diff = await freshState.diff(prevActionResult);
|
|
365
|
-
await diff.calculate();
|
|
366
352
|
ariaChanges = diff.ariaChanged;
|
|
367
353
|
}
|
|
368
354
|
catch (err) {
|
|
@@ -446,21 +432,14 @@ class Navigator {
|
|
|
446
432
|
return resolved;
|
|
447
433
|
}
|
|
448
434
|
buildExperienceTools() {
|
|
435
|
+
if (!this.experienceTracker)
|
|
436
|
+
return undefined;
|
|
449
437
|
const stateManager = this.explorer.getStateManager();
|
|
450
438
|
const getState = () => {
|
|
451
439
|
const s = stateManager.getCurrentState();
|
|
452
440
|
return s ? ActionResult.fromState(s) : null;
|
|
453
441
|
};
|
|
454
|
-
|
|
455
|
-
explorer: this.explorer,
|
|
456
|
-
researcher: null,
|
|
457
|
-
navigator: this,
|
|
458
|
-
experienceTracker: this.experienceTracker,
|
|
459
|
-
getState,
|
|
460
|
-
});
|
|
461
|
-
if (!learnExperience)
|
|
462
|
-
return undefined;
|
|
463
|
-
return { learnExperience };
|
|
442
|
+
return { learnExperience: createLearnExperienceTool({ getExperienceTracker: () => this.experienceTracker, getState }) };
|
|
464
443
|
}
|
|
465
444
|
async freeSail(opts, actionResult) {
|
|
466
445
|
const stateManager = this.explorer.getStateManager();
|
|
@@ -579,24 +558,10 @@ class Navigator {
|
|
|
579
558
|
tag('operation').log(`Reusing cached verification: ${cachedVerification ? 'PASS' : 'FAIL'}`);
|
|
580
559
|
return { verified: cachedVerification, successfulCodes: [], assertionSteps: [], totalAttempted: 0 };
|
|
581
560
|
}
|
|
582
|
-
|
|
561
|
+
const knowledge = this.knowledgeTracker.renderRelevantKnowledge(actionResult);
|
|
583
562
|
let experience = '';
|
|
584
|
-
const relevantKnowledge = this.knowledgeTracker.getRelevantKnowledge(actionResult);
|
|
585
|
-
if (relevantKnowledge.length > 0) {
|
|
586
|
-
const knowledgeContent = relevantKnowledge.map((k) => k.content).join('\n\n');
|
|
587
|
-
knowledge = `
|
|
588
|
-
<hint>
|
|
589
|
-
Here is relevant knowledge for this page:
|
|
590
|
-
${knowledgeContent}
|
|
591
|
-
</hint>`;
|
|
592
|
-
}
|
|
593
563
|
if (!actionResult.isInsideIframe) {
|
|
594
|
-
|
|
595
|
-
if (toc.length > 0) {
|
|
596
|
-
const totalSections = toc.reduce((sum, entry) => sum + entry.sections.length, 0);
|
|
597
|
-
tag('operation').log(`Found ${toc.length} experience ${pluralize(toc.length, 'file')} (${totalSections} sections) for: ${actionResult.url}`);
|
|
598
|
-
experience = renderExperienceToc(toc);
|
|
599
|
-
}
|
|
564
|
+
experience = this.experienceTracker.renderExperienceTocFor(actionResult);
|
|
600
565
|
}
|
|
601
566
|
const priorVerifications = Object.entries(actionResult.verifications ?? {});
|
|
602
567
|
let verificationContext = '';
|
|
@@ -685,7 +650,7 @@ class Navigator {
|
|
|
685
650
|
return;
|
|
686
651
|
}
|
|
687
652
|
await this.explorer.switchToMainFrame();
|
|
688
|
-
const verified = await action.attempt(codeBlock, message
|
|
653
|
+
const verified = await action.attempt(codeBlock, message);
|
|
689
654
|
if (verified) {
|
|
690
655
|
tag('success').log('Verification passed');
|
|
691
656
|
successfulCodes.push(codeBlock);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ActionResult } from '../action-result.js';
|
|
2
|
+
import type Explorer from '../explorer.js';
|
|
3
|
+
import { type Test } from '../test-plan.js';
|
|
4
|
+
import type { Agent } from './agent.js';
|
|
5
|
+
import type { Conversation } from './conversation.js';
|
|
6
|
+
import type { Fisherman } from './fisherman.js';
|
|
7
|
+
import type { Navigator } from './navigator.js';
|
|
8
|
+
import type { Provider } from './provider.js';
|
|
9
|
+
import type { Researcher } from './researcher.js';
|
|
10
|
+
export declare class Pilot implements Agent {
|
|
11
|
+
emoji: string;
|
|
12
|
+
provider: Provider;
|
|
13
|
+
agentTools: any;
|
|
14
|
+
conversation: Conversation | null;
|
|
15
|
+
researcher: Researcher;
|
|
16
|
+
explorer: Explorer;
|
|
17
|
+
fisherman: Fisherman | null;
|
|
18
|
+
constructor(provider: Provider, agentTools: any, researcher: Researcher, explorer: Explorer);
|
|
19
|
+
setFisherman(fisherman: Fisherman): void;
|
|
20
|
+
get stepsToReview(): number;
|
|
21
|
+
reset(): void;
|
|
22
|
+
getLastAnalysis(): string | null;
|
|
23
|
+
reviewStop(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
24
|
+
reviewFinish(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
25
|
+
reviewCompletion(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
26
|
+
finalReview(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
27
|
+
reviewReset(task: Test, currentState: ActionResult, reason: string, testerConversation: Conversation): Promise<boolean>;
|
|
28
|
+
reviewDecision(type: 'finish' | 'stop', task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
29
|
+
reviewResetDecision(task: Test, currentState: ActionResult, reason: string, testerConversation: Conversation): Promise<boolean>;
|
|
30
|
+
buildSharedEvidenceRules(task: Test): string;
|
|
31
|
+
buildResetSystemPrompt(task: Test): string;
|
|
32
|
+
buildVerdictSystemPrompt(type: string, task: Test): string;
|
|
33
|
+
planTest(task: Test, currentState: ActionResult): Promise<string>;
|
|
34
|
+
reviewNewPage(task: Test, currentState: ActionResult, testerConversation: Conversation): Promise<string>;
|
|
35
|
+
analyzeProgress(task: Test, currentState: ActionResult, testerConversation: Conversation): Promise<string>;
|
|
36
|
+
formatExpectations(task: Test): string;
|
|
37
|
+
sendToPilot(userText: string, functionId: string, opts?: {
|
|
38
|
+
tools?: boolean;
|
|
39
|
+
maxToolRoundtrips?: number;
|
|
40
|
+
task?: Test;
|
|
41
|
+
}): Promise<string>;
|
|
42
|
+
getExperienceToc(): string;
|
|
43
|
+
pickPlanningTools(): Record<string, unknown>;
|
|
44
|
+
buildPreconditionTool(task: Test): {
|
|
45
|
+
precondition: import("@ai-sdk/provider-utils").ExecutableTool<import("ai").Tool<{
|
|
46
|
+
description: any;
|
|
47
|
+
}, {
|
|
48
|
+
noted: boolean;
|
|
49
|
+
prepared: boolean;
|
|
50
|
+
skipped: boolean;
|
|
51
|
+
reason: string;
|
|
52
|
+
created?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
noted: boolean;
|
|
55
|
+
prepared: boolean;
|
|
56
|
+
reason: string;
|
|
57
|
+
skipped?: undefined;
|
|
58
|
+
created?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
noted: boolean;
|
|
61
|
+
prepared: boolean;
|
|
62
|
+
created: {
|
|
63
|
+
type: string;
|
|
64
|
+
id?: string | number;
|
|
65
|
+
title?: string;
|
|
66
|
+
}[];
|
|
67
|
+
skipped?: undefined;
|
|
68
|
+
reason?: undefined;
|
|
69
|
+
}, import("@ai-sdk/provider-utils").Context>>;
|
|
70
|
+
};
|
|
71
|
+
checkDataAvailability(task: Test, requestedData: string, fishermanReason: string | undefined): Promise<string | null>;
|
|
72
|
+
buildStateContext(state: ActionResult): string;
|
|
73
|
+
fetchRequestedContext(text: string, currentState: ActionResult): Promise<string>;
|
|
74
|
+
formatSessionLog(testerConversation: Conversation): string;
|
|
75
|
+
hasCompletionEvidence(task: Test, currentState: ActionResult, testerConversation: Conversation): boolean;
|
|
76
|
+
hasSuccessfulCheckEvidence(currentState: ActionResult, testerConversation: Conversation): boolean;
|
|
77
|
+
formatSuccessfulAssertions(currentState: ActionResult, testerConversation: Conversation): string;
|
|
78
|
+
formatActions(toolCalls: any[]): string;
|
|
79
|
+
buildDeletionScope(task: Test): string;
|
|
80
|
+
getSystemPrompt(task: Test, initialState: ActionResult): string;
|
|
81
|
+
}
|
package/dist/src/ai/pilot.js
CHANGED
|
@@ -3,7 +3,6 @@ import dedent from 'dedent';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ActionResult } from "../action-result.js";
|
|
5
5
|
import { ConfigParser } from "../config.js";
|
|
6
|
-
import { renderExperienceToc } from "../experience-tracker.js";
|
|
7
6
|
import { TestResult } from "../test-plan.js";
|
|
8
7
|
import { collectInteractiveNodes, detectFocusArea, extractFocusedElement } from "../utils/aria.js";
|
|
9
8
|
import { ErrorPageError } from "../utils/error-page.js";
|
|
@@ -22,13 +21,11 @@ export class Pilot {
|
|
|
22
21
|
researcher;
|
|
23
22
|
explorer;
|
|
24
23
|
fisherman = null;
|
|
25
|
-
|
|
26
|
-
constructor(provider, agentTools, researcher, explorer, experienceTracker) {
|
|
24
|
+
constructor(provider, agentTools, researcher, explorer) {
|
|
27
25
|
this.provider = provider;
|
|
28
26
|
this.agentTools = agentTools;
|
|
29
27
|
this.researcher = researcher;
|
|
30
28
|
this.explorer = explorer;
|
|
31
|
-
this.experienceTracker = experienceTracker || null;
|
|
32
29
|
}
|
|
33
30
|
setFisherman(fisherman) {
|
|
34
31
|
this.fisherman = fisherman;
|
|
@@ -90,7 +87,7 @@ export class Pilot {
|
|
|
90
87
|
requestVerification: z
|
|
91
88
|
.string()
|
|
92
89
|
.nullable()
|
|
93
|
-
.describe('REQUIRED whenever decision is "pass" — a one-sentence natural-language claim about the current page that, if true, proves the scenario goal (e.g., "New
|
|
90
|
+
.describe('REQUIRED whenever decision is "pass" — a one-sentence natural-language claim about the current page that, if true, proves the scenario goal (e.g., "New item \\"Foo\\" is visible in the items list"). NOT code: do not write I.*, expect(), .then(), grabTitle, or any JavaScript. Navigator translates the claim into CodeceptJS assertions and runs them; passing assertions are saved to the generated test file. Also use when evidence is insufficient before deciding pass/fail. Leave null for "continue", "fail", or "skipped".'),
|
|
94
91
|
});
|
|
95
92
|
const userContent = dedent `
|
|
96
93
|
Tester wants to ${type} the test.
|
|
@@ -124,7 +121,7 @@ export class Pilot {
|
|
|
124
121
|
- Mixed evidence + final state shows success → pass. Mixed + final state unclear → continue with guidance.
|
|
125
122
|
|
|
126
123
|
When deciding "pass", you MUST also set requestVerification to a one-sentence natural-language
|
|
127
|
-
claim about the current page (e.g., "New
|
|
124
|
+
claim about the current page (e.g., "New item Foo is visible in the items list"). NOT
|
|
128
125
|
code — do not write I.*, expect(), .then(), or any JavaScript. Choose the strongest single
|
|
129
126
|
piece of evidence (a unique element/text that exists ONLY because the scenario succeeded).
|
|
130
127
|
Navigator translates the claim into CodeceptJS assertions; without it the generated test has
|
|
@@ -379,10 +376,6 @@ export class Pilot {
|
|
|
379
376
|
|
|
380
377
|
FIRST: Decide if precondition() is needed.
|
|
381
378
|
|
|
382
|
-
${capabilityGroundingRule}
|
|
383
|
-
|
|
384
|
-
${dataProtectionRules}
|
|
385
|
-
|
|
386
379
|
Call precondition() WHEN:
|
|
387
380
|
- The scenario edits/deletes/modifies an item, and you want a DISPOSABLE item to act on safely
|
|
388
381
|
- The scenario needs specific data clearly NOT on the current page (e.g., items with specific statuses for filtering)
|
|
@@ -525,14 +518,10 @@ export class Pilot {
|
|
|
525
518
|
`;
|
|
526
519
|
}
|
|
527
520
|
getExperienceToc() {
|
|
528
|
-
if (!this.experienceTracker)
|
|
529
|
-
return '';
|
|
530
521
|
const state = this.explorer.getStateManager().getCurrentState();
|
|
531
522
|
if (!state)
|
|
532
523
|
return '';
|
|
533
|
-
|
|
534
|
-
const toc = this.experienceTracker.getExperienceTableOfContents(actionResult);
|
|
535
|
-
return renderExperienceToc(toc);
|
|
524
|
+
return this.explorer.getStateManager().getExperienceTracker().renderExperienceTocFor(ActionResult.fromState(state));
|
|
536
525
|
}
|
|
537
526
|
pickPlanningTools() {
|
|
538
527
|
const { see, context, verify, research, getVisitedStates, xpathCheck, learnExperience, askUser } = this.agentTools ?? {};
|
|
@@ -957,8 +946,8 @@ export class Pilot {
|
|
|
957
946
|
|
|
958
947
|
${dataProtectionRules}
|
|
959
948
|
|
|
960
|
-
Describe WHAT to create, not what exists. RIGHT: precondition("1
|
|
961
|
-
precondition("1
|
|
949
|
+
Describe WHAT to create, not what exists. RIGHT: precondition("1 post"). WRONG:
|
|
950
|
+
precondition("1 post named Updated Post with existing comments"). Keep descriptions short.
|
|
962
951
|
|
|
963
952
|
Response format:
|
|
964
953
|
PROGRESS: <1 sentence assessment>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Plan } from '../../test-plan.js';
|
|
2
|
+
import type { Constructor } from '../researcher/mixin.js';
|
|
3
|
+
export declare function WithSessionDedup<T extends Constructor>(Base: T): {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
currentPlan: Plan | null;
|
|
6
|
+
registerPlanInSession(plan: Plan): void;
|
|
7
|
+
getSessionTestsSummary(): string;
|
|
8
|
+
getPreviousSessionScenarios(): Set<string>;
|
|
9
|
+
getPreviousSessionScenariosExcluding(plan: Plan): Set<string>;
|
|
10
|
+
};
|
|
11
|
+
} & T;
|
|
12
|
+
export declare function clearSessionDedup(): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { StateManager } from '../../state-manager.js';
|
|
2
|
+
import type { Plan } from '../../test-plan.js';
|
|
3
|
+
import type { Provider } from '../provider.js';
|
|
4
|
+
import type { Constructor } from '../researcher/mixin.js';
|
|
5
|
+
export declare function registerPlan(url: string, plan: Plan, feature?: string, stateHash?: string): void;
|
|
6
|
+
export declare function getRegisteredPlan(url: string, feature?: string): PlanRecord | undefined;
|
|
7
|
+
export declare function isPagePlanned(url: string): boolean;
|
|
8
|
+
export declare function clearPlanRegistry(url?: string): void;
|
|
9
|
+
export declare function isTemplateMatch(urlA: string, urlB: string): boolean;
|
|
10
|
+
export declare function getPlannedByStateHash(hash: string): PlanRecord | null;
|
|
11
|
+
export declare function WithSubPages<T extends Constructor>(Base: T): {
|
|
12
|
+
new (...args: any[]): {
|
|
13
|
+
provider: Provider;
|
|
14
|
+
stateManager: StateManager;
|
|
15
|
+
collectSubPageCandidates(plan: Plan, currentUrl: string): SubPageCandidate[];
|
|
16
|
+
pickNextSubPage(candidates: SubPageCandidate[]): Promise<{
|
|
17
|
+
url: string;
|
|
18
|
+
reason: string;
|
|
19
|
+
} | null>;
|
|
20
|
+
findSimilarPlan(url: string): PlanRecord | null;
|
|
21
|
+
};
|
|
22
|
+
} & T;
|
|
23
|
+
type PlanRecord = {
|
|
24
|
+
plan: Plan;
|
|
25
|
+
feature?: string;
|
|
26
|
+
url: string;
|
|
27
|
+
stateHash?: string;
|
|
28
|
+
};
|
|
29
|
+
type SubPageCandidate = {
|
|
30
|
+
url: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
h1?: string;
|
|
33
|
+
visitCount: number;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ActionResult } from '../action-result.js';
|
|
2
|
+
import type { ExperienceTracker } from '../experience-tracker.js';
|
|
3
|
+
import type Explorer from '../explorer.js';
|
|
4
|
+
import type { StateManager } from '../state-manager.js';
|
|
5
|
+
import { Suite } from '../suite.js';
|
|
6
|
+
import { Plan, Test } from '../test-plan.js';
|
|
7
|
+
import type { Agent } from './agent.js';
|
|
8
|
+
import { Conversation } from './conversation.js';
|
|
9
|
+
import type { Fisherman } from './fisherman.js';
|
|
10
|
+
import type { Provider } from './provider.js';
|
|
11
|
+
import { type Researcher } from './researcher.js';
|
|
12
|
+
declare const PlannerBase: {
|
|
13
|
+
new (...args: any[]): {
|
|
14
|
+
currentPlan: Plan | null;
|
|
15
|
+
registerPlanInSession(plan: Plan): void;
|
|
16
|
+
getSessionTestsSummary(): string;
|
|
17
|
+
getPreviousSessionScenarios(): Set<string>;
|
|
18
|
+
getPreviousSessionScenariosExcluding(plan: Plan): Set<string>;
|
|
19
|
+
};
|
|
20
|
+
} & {
|
|
21
|
+
new (...args: any[]): {
|
|
22
|
+
provider: Provider;
|
|
23
|
+
stateManager: StateManager;
|
|
24
|
+
collectSubPageCandidates(plan: Plan, currentUrl: string): {
|
|
25
|
+
url: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
h1?: string;
|
|
28
|
+
visitCount: number;
|
|
29
|
+
}[];
|
|
30
|
+
pickNextSubPage(candidates: {
|
|
31
|
+
url: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
h1?: string;
|
|
34
|
+
visitCount: number;
|
|
35
|
+
}[]): Promise<{
|
|
36
|
+
url: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
}>;
|
|
39
|
+
findSimilarPlan(url: string): {
|
|
40
|
+
plan: Plan;
|
|
41
|
+
feature?: string;
|
|
42
|
+
url: string;
|
|
43
|
+
stateHash?: string;
|
|
44
|
+
} | null;
|
|
45
|
+
};
|
|
46
|
+
} & (new (...args: any[]) => object);
|
|
47
|
+
export declare class Planner extends PlannerBase implements Agent {
|
|
48
|
+
emoji: string;
|
|
49
|
+
explorer: Explorer;
|
|
50
|
+
provider: Provider;
|
|
51
|
+
stateManager: StateManager;
|
|
52
|
+
experienceTracker: ExperienceTracker;
|
|
53
|
+
MIN_TASKS: number;
|
|
54
|
+
MAX_TASKS: number;
|
|
55
|
+
currentPlan: Plan | null;
|
|
56
|
+
freshStart: boolean;
|
|
57
|
+
lastStyleName: string;
|
|
58
|
+
lastSuite: Suite | null;
|
|
59
|
+
researcher: Researcher;
|
|
60
|
+
fisherman: Fisherman | null;
|
|
61
|
+
constructor(explorer: Explorer, provider: Provider, researcher: Researcher);
|
|
62
|
+
setFisherman(fisherman: Fisherman): void;
|
|
63
|
+
get sectionOrder(): string[];
|
|
64
|
+
getDefaultStartUrl(state: {
|
|
65
|
+
url: string;
|
|
66
|
+
fullUrl?: string;
|
|
67
|
+
}): string;
|
|
68
|
+
getSystemMessage(feature?: string): string;
|
|
69
|
+
setPlan(plan: Plan): void;
|
|
70
|
+
static getCachedPlan(url: string): Plan | null;
|
|
71
|
+
plan(feature?: string, style?: string, parentPlan?: Plan, completedPlans?: Plan[]): Promise<Plan>;
|
|
72
|
+
getSuite(): Suite | null;
|
|
73
|
+
addNewTests(tests: Test[], defaultStartUrl: string): Test[];
|
|
74
|
+
getExistingTestFileScenarios(currentUrl?: string): Set<string>;
|
|
75
|
+
cleanExperienceFlows(text: string): string | null;
|
|
76
|
+
buildApproach(style?: string): string;
|
|
77
|
+
buildConversation(state: ActionResult, style?: string, parentPlan?: Plan, feature?: string): Promise<Conversation>;
|
|
78
|
+
}
|
|
79
|
+
export {};
|