explorbot 0.1.30 → 0.1.32-beta.1
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/dist/boat/api-tester/example/apibot.config.js +30 -0
- package/dist/package.json +11 -26
- package/dist/src/action-result.d.ts +133 -0
- package/dist/src/action-result.js +22 -7
- package/dist/src/action.d.ts +50 -0
- package/dist/src/action.js +10 -5
- 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.d.ts +143 -0
- package/dist/src/ai/conversation.d.ts +31 -0
- package/dist/src/ai/conversation.js +1 -1
- package/dist/src/ai/driller.d.ts +161 -0
- package/dist/src/ai/experience-compactor.d.ts +53 -0
- package/dist/src/ai/fisherman-tools.d.ts +90 -0
- package/dist/src/ai/fisherman.d.ts +30 -0
- package/dist/src/ai/historian/codeceptjs.d.ts +15 -0
- 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 +20 -0
- package/dist/src/ai/historian/screencast.d.ts +32 -0
- package/dist/src/ai/historian/utils.d.ts +4 -0
- package/dist/src/ai/historian.d.ts +108 -0
- package/dist/src/ai/navigator.d.ts +56 -0
- package/dist/src/ai/pilot.d.ts +83 -0
- 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/provider.d.ts +50 -0
- package/dist/src/ai/provider.js +13 -5
- package/dist/src/ai/quartermaster.d.ts +57 -0
- package/dist/src/ai/rerunner.d.ts +49 -0
- package/dist/src/ai/researcher/cache.d.ts +6 -0
- 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/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/research-result.d.ts +16 -0
- package/dist/src/ai/researcher/sections.d.ts +19 -0
- package/dist/src/ai/rules.d.ts +15 -0
- package/dist/src/ai/session-analyst.d.ts +11 -0
- package/dist/src/ai/task-agent.d.ts +28 -0
- package/dist/src/ai/tester.d.ts +103 -0
- package/dist/src/ai/tools.d.ts +41 -0
- 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/context-aria-command.d.ts +6 -0
- package/dist/src/commands/context-command.d.ts +11 -0
- 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/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/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/learn-command.d.ts +7 -0
- 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 +8 -0
- package/dist/src/components/AddRule.d.ts +9 -0
- package/dist/src/components/App.d.ts +9 -0
- 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 +251 -0
- package/dist/src/execution-controller.d.ts +25 -0
- package/dist/src/experience-tracker.d.ts +107 -0
- package/dist/src/experience-tracker.js +2 -1
- package/dist/src/explorbot.d.ts +107 -0
- package/dist/src/explorer.d.ts +140 -0
- package/dist/src/explorer.js +13 -9
- 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 +9 -2
- 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 +185 -0
- package/dist/src/state-manager.js +0 -7
- 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 +20 -0
- package/dist/src/utils/browser-errors.d.ts +8 -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 +25 -0
- 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 +124 -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-parser.d.ts +17 -0
- package/dist/src/utils/markdown-query.d.ts +40 -0
- 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 +6 -0
- 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 +3 -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 +44 -0
- package/dist/src/utils/xpath.d.ts +17 -0
- package/package.json +11 -26
- package/src/action-result.ts +22 -7
- package/src/action.ts +12 -5
- package/src/ai/conversation.ts +1 -1
- package/src/ai/provider.ts +13 -5
- package/src/experience-tracker.ts +2 -1
- package/src/explorer.ts +14 -9
- package/src/index.ts +9 -0
- package/src/knowledge-tracker.ts +7 -1
- package/src/observability.ts +2 -1
- package/src/state-manager.ts +0 -8
- package/src/utils/secrets.ts +29 -0
- package/src/index.tsx +0 -62
|
@@ -0,0 +1,83 @@
|
|
|
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 Test } from '../test-plan.js';
|
|
5
|
+
import type { Agent } from './agent.js';
|
|
6
|
+
import type { Conversation } from './conversation.js';
|
|
7
|
+
import type { Fisherman } from './fisherman.js';
|
|
8
|
+
import type { Navigator } from './navigator.js';
|
|
9
|
+
import type { Provider } from './provider.js';
|
|
10
|
+
import type { Researcher } from './researcher.js';
|
|
11
|
+
export declare class Pilot implements Agent {
|
|
12
|
+
emoji: string;
|
|
13
|
+
provider: Provider;
|
|
14
|
+
agentTools: any;
|
|
15
|
+
conversation: Conversation | null;
|
|
16
|
+
researcher: Researcher;
|
|
17
|
+
explorer: Explorer;
|
|
18
|
+
fisherman: Fisherman | null;
|
|
19
|
+
experienceTracker: ExperienceTracker | null;
|
|
20
|
+
constructor(provider: Provider, agentTools: any, researcher: Researcher, explorer: Explorer, experienceTracker?: ExperienceTracker);
|
|
21
|
+
setFisherman(fisherman: Fisherman): void;
|
|
22
|
+
get stepsToReview(): number;
|
|
23
|
+
reset(): void;
|
|
24
|
+
getLastAnalysis(): string | null;
|
|
25
|
+
reviewStop(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
26
|
+
reviewFinish(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
27
|
+
reviewCompletion(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
28
|
+
finalReview(task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
29
|
+
reviewReset(task: Test, currentState: ActionResult, reason: string, testerConversation: Conversation): Promise<boolean>;
|
|
30
|
+
reviewDecision(type: 'finish' | 'stop', task: Test, currentState: ActionResult, testerConversation: Conversation, navigator?: Navigator): Promise<boolean>;
|
|
31
|
+
reviewResetDecision(task: Test, currentState: ActionResult, reason: string, testerConversation: Conversation): Promise<boolean>;
|
|
32
|
+
buildSharedEvidenceRules(task: Test): string;
|
|
33
|
+
buildResetSystemPrompt(task: Test): string;
|
|
34
|
+
buildVerdictSystemPrompt(type: string, task: Test): string;
|
|
35
|
+
planTest(task: Test, currentState: ActionResult): Promise<string>;
|
|
36
|
+
reviewNewPage(task: Test, currentState: ActionResult, testerConversation: Conversation): Promise<string>;
|
|
37
|
+
analyzeProgress(task: Test, currentState: ActionResult, testerConversation: Conversation): Promise<string>;
|
|
38
|
+
formatExpectations(task: Test): string;
|
|
39
|
+
sendToPilot(userText: string, functionId: string, opts?: {
|
|
40
|
+
tools?: boolean;
|
|
41
|
+
maxToolRoundtrips?: number;
|
|
42
|
+
task?: Test;
|
|
43
|
+
}): Promise<string>;
|
|
44
|
+
getExperienceToc(): string;
|
|
45
|
+
pickPlanningTools(): Record<string, unknown>;
|
|
46
|
+
buildPreconditionTool(task: Test): {
|
|
47
|
+
precondition: import("@ai-sdk/provider-utils").ExecutableTool<import("ai").Tool<{
|
|
48
|
+
description: any;
|
|
49
|
+
}, {
|
|
50
|
+
noted: boolean;
|
|
51
|
+
prepared: boolean;
|
|
52
|
+
skipped: boolean;
|
|
53
|
+
reason: string;
|
|
54
|
+
created?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
noted: boolean;
|
|
57
|
+
prepared: boolean;
|
|
58
|
+
reason: string;
|
|
59
|
+
skipped?: undefined;
|
|
60
|
+
created?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
noted: boolean;
|
|
63
|
+
prepared: boolean;
|
|
64
|
+
created: {
|
|
65
|
+
type: string;
|
|
66
|
+
id?: string | number;
|
|
67
|
+
title?: string;
|
|
68
|
+
}[];
|
|
69
|
+
skipped?: undefined;
|
|
70
|
+
reason?: undefined;
|
|
71
|
+
}, import("@ai-sdk/provider-utils").Context>>;
|
|
72
|
+
};
|
|
73
|
+
checkDataAvailability(task: Test, requestedData: string, fishermanReason: string | undefined): Promise<string | null>;
|
|
74
|
+
buildStateContext(state: ActionResult): string;
|
|
75
|
+
fetchRequestedContext(text: string, currentState: ActionResult): Promise<string>;
|
|
76
|
+
formatSessionLog(testerConversation: Conversation): string;
|
|
77
|
+
hasCompletionEvidence(task: Test, currentState: ActionResult, testerConversation: Conversation): boolean;
|
|
78
|
+
hasSuccessfulCheckEvidence(currentState: ActionResult, testerConversation: Conversation): boolean;
|
|
79
|
+
formatSuccessfulAssertions(currentState: ActionResult, testerConversation: Conversation): string;
|
|
80
|
+
formatActions(toolCalls: any[]): string;
|
|
81
|
+
buildDeletionScope(task: Test): string;
|
|
82
|
+
getSystemPrompt(task: Test, initialState: ActionResult): string;
|
|
83
|
+
}
|
|
@@ -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 { 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 { 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);
|
|
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 {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
2
|
+
import type { ModelMessage } from 'ai';
|
|
3
|
+
import type { AIConfig } from '../config.js';
|
|
4
|
+
import { type RetryOptions } from '../utils/retry.js';
|
|
5
|
+
import { Conversation } from './conversation.js';
|
|
6
|
+
declare class AiError extends Error {
|
|
7
|
+
}
|
|
8
|
+
export declare class ContextLengthError extends Error {
|
|
9
|
+
}
|
|
10
|
+
export declare class Provider {
|
|
11
|
+
config: AIConfig;
|
|
12
|
+
telemetryEnabled: boolean;
|
|
13
|
+
otelSdk: NodeSDK | null;
|
|
14
|
+
defaultRetryOptions: RetryOptions;
|
|
15
|
+
static readonly CONTEXT_LENGTH_PATTERNS: string[];
|
|
16
|
+
lastConversation: Conversation | null;
|
|
17
|
+
constructor(config: AIConfig);
|
|
18
|
+
getModelName(model: any): string;
|
|
19
|
+
validateConnection(): Promise<void>;
|
|
20
|
+
getModelForAgent(agentName?: string): any;
|
|
21
|
+
getAgenticModel(agentName?: string): any;
|
|
22
|
+
getConfiguredModels(): Record<string, string>;
|
|
23
|
+
getSystemPromptForAgent(agentName: string, currentUrl?: string): string | undefined;
|
|
24
|
+
getProviderOptionsForAgent(agentName: string): Record<string, any> | undefined;
|
|
25
|
+
getReasoningForAgent(agentName?: string): string | undefined;
|
|
26
|
+
getRetryOptions(options?: any): RetryOptions;
|
|
27
|
+
mergeProviderOptions(config: Record<string, any>, agentName?: string): Record<string, any>;
|
|
28
|
+
finalizeConfig(config: Record<string, any>, options: any, telemetry: any): void;
|
|
29
|
+
initLangfuse(): void;
|
|
30
|
+
getTelemetry(options: any): any;
|
|
31
|
+
startConversation(systemMessage: string, agentName?: string, model?: any): Conversation;
|
|
32
|
+
invokeConversation(conversation: Conversation, tools?: any, options?: any): Promise<{
|
|
33
|
+
conversation: Conversation;
|
|
34
|
+
response: any;
|
|
35
|
+
toolExecutions?: any[];
|
|
36
|
+
} | null>;
|
|
37
|
+
chat(messages: ModelMessage[], model: any, options?: any): Promise<any>;
|
|
38
|
+
generateWithTools(messages: ModelMessage[], model: any, tools: any, options?: any): Promise<any>;
|
|
39
|
+
generateObject(messages: ModelMessage[], schema: any, model?: any, options?: any): Promise<any>;
|
|
40
|
+
static isContextLengthError(error: any): boolean;
|
|
41
|
+
static trimMessagesForRetry(messages: ModelMessage[]): ModelMessage[] | null;
|
|
42
|
+
static compactMessagesForRetry(messages: ModelMessage[]): ModelMessage[] | null;
|
|
43
|
+
tryReduceMessages(messages: ModelMessage[], retryLevel: number): {
|
|
44
|
+
messages: ModelMessage[];
|
|
45
|
+
nextLevel: number;
|
|
46
|
+
} | null;
|
|
47
|
+
processImage(prompt: string, image: string): Promise<any>;
|
|
48
|
+
hasVision(): boolean;
|
|
49
|
+
}
|
|
50
|
+
export { AiError, Provider as AIProvider };
|
package/dist/src/ai/provider.js
CHANGED
|
@@ -28,7 +28,7 @@ function extractCachedTokens(usage) {
|
|
|
28
28
|
const fromRaw = raw?.prompt_tokens_details?.cached_tokens ?? raw?.promptTokensDetails?.cachedTokens;
|
|
29
29
|
return typeof fromRaw === 'number' ? fromRaw : 0;
|
|
30
30
|
}
|
|
31
|
-
function rejectAfterIdle(ms, signal) {
|
|
31
|
+
function rejectAfterIdle(ms, signal, controller) {
|
|
32
32
|
return new Promise((_, reject) => {
|
|
33
33
|
const tick = () => {
|
|
34
34
|
if (signal.cancelled)
|
|
@@ -37,6 +37,7 @@ function rejectAfterIdle(ms, signal) {
|
|
|
37
37
|
setTimeout(tick, ms);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
+
controller.abort();
|
|
40
41
|
reject(new Error('AI request timeout'));
|
|
41
42
|
};
|
|
42
43
|
setTimeout(tick, ms);
|
|
@@ -329,13 +330,16 @@ export class Provider {
|
|
|
329
330
|
const response = await withRetry(async () => {
|
|
330
331
|
const timeout = config.timeout || 30000;
|
|
331
332
|
const cancel = { cancelled: false };
|
|
333
|
+
const controller = new AbortController();
|
|
334
|
+
const combinedSignal = AbortSignal.any([controller.signal, executionController.getAbortSignal()].filter(Boolean));
|
|
332
335
|
try {
|
|
333
336
|
const result = (await Promise.race([
|
|
334
337
|
generateText({
|
|
335
338
|
messages,
|
|
336
339
|
...config,
|
|
340
|
+
abortSignal: combinedSignal,
|
|
337
341
|
}),
|
|
338
|
-
rejectAfterIdle(timeout, cancel),
|
|
342
|
+
rejectAfterIdle(timeout, cancel, controller),
|
|
339
343
|
]));
|
|
340
344
|
const hasToolCall = (result.toolCalls?.length || 0) > 0;
|
|
341
345
|
if (!result.text && !hasToolCall && result.finishReason === 'length') {
|
|
@@ -410,13 +414,16 @@ export class Provider {
|
|
|
410
414
|
const response = await withRetry(async () => {
|
|
411
415
|
const timeout = config.timeout || 30000;
|
|
412
416
|
const cancel = { cancelled: false };
|
|
417
|
+
const controller = new AbortController();
|
|
418
|
+
const combinedSignal = AbortSignal.any([controller.signal, executionController.getAbortSignal()].filter(Boolean));
|
|
413
419
|
try {
|
|
414
420
|
return (await Promise.race([
|
|
415
421
|
generateObject({
|
|
416
422
|
messages,
|
|
417
423
|
...config,
|
|
424
|
+
abortSignal: combinedSignal,
|
|
418
425
|
}),
|
|
419
|
-
rejectAfterIdle(timeout, cancel),
|
|
426
|
+
rejectAfterIdle(timeout, cancel, controller),
|
|
420
427
|
]));
|
|
421
428
|
}
|
|
422
429
|
finally {
|
|
@@ -578,8 +585,9 @@ export class Provider {
|
|
|
578
585
|
text: prompt,
|
|
579
586
|
},
|
|
580
587
|
{
|
|
581
|
-
type: '
|
|
582
|
-
|
|
588
|
+
type: 'file',
|
|
589
|
+
mediaType: 'image/png',
|
|
590
|
+
data: imageData,
|
|
583
591
|
},
|
|
584
592
|
],
|
|
585
593
|
},
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ActionResult } from '../action-result.js';
|
|
2
|
+
import type { StateManager, StateTransition, WebPageState } from '../state-manager.js';
|
|
3
|
+
import type { Task } from '../test-plan.js';
|
|
4
|
+
import type { Conversation, ToolExecution } from './conversation.js';
|
|
5
|
+
import type { Provider } from './provider.js';
|
|
6
|
+
interface AxeViolation {
|
|
7
|
+
id: string;
|
|
8
|
+
impact: 'critical' | 'serious' | 'moderate' | 'minor';
|
|
9
|
+
description: string;
|
|
10
|
+
helpUrl: string;
|
|
11
|
+
nodes: Array<{
|
|
12
|
+
html: string;
|
|
13
|
+
target: string[];
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
interface PageAnalysis {
|
|
17
|
+
url: string;
|
|
18
|
+
stateHash: string;
|
|
19
|
+
timestamp: string;
|
|
20
|
+
axeViolations: AxeViolation[];
|
|
21
|
+
}
|
|
22
|
+
interface SemanticIssue {
|
|
23
|
+
type: 'unclear_intention' | 'confusing_naming' | 'hard_to_interact';
|
|
24
|
+
element: string;
|
|
25
|
+
issue: string;
|
|
26
|
+
suggestion: string;
|
|
27
|
+
}
|
|
28
|
+
interface AnalysisReport {
|
|
29
|
+
scenario: string;
|
|
30
|
+
timestamp: string;
|
|
31
|
+
url: string;
|
|
32
|
+
axeViolations: AxeViolation[];
|
|
33
|
+
semanticIssues: SemanticIssue[];
|
|
34
|
+
}
|
|
35
|
+
export declare class Quartermaster {
|
|
36
|
+
provider: Provider;
|
|
37
|
+
model?: any;
|
|
38
|
+
outputDir: string;
|
|
39
|
+
pageAnalyses: Map<string, PageAnalysis>;
|
|
40
|
+
unsubscribe: (() => void) | null;
|
|
41
|
+
playwrightHelper: any;
|
|
42
|
+
pendingAnalyses: Promise<void>[];
|
|
43
|
+
constructor(provider: Provider, options?: {
|
|
44
|
+
model?: any;
|
|
45
|
+
});
|
|
46
|
+
start(playwrightHelper: any, stateManager: StateManager): void;
|
|
47
|
+
stop(): void;
|
|
48
|
+
ensureDirectory(): void;
|
|
49
|
+
onPageChange(event: StateTransition): void;
|
|
50
|
+
runAxeAnalysis(state: WebPageState): Promise<void>;
|
|
51
|
+
analyzeSession(task: Task, initialState: ActionResult, conversation: Conversation): Promise<AnalysisReport | null>;
|
|
52
|
+
generateSemanticAnalysis(axeViolations: AxeViolation[], executions: ToolExecution[], initialState: ActionResult): Promise<SemanticIssue[]>;
|
|
53
|
+
addNotesToTask(task: Task, report: AnalysisReport): void;
|
|
54
|
+
saveReport(stateHash: string, report: AnalysisReport): void;
|
|
55
|
+
formatReportMarkdown(report: AnalysisReport): string;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ExperienceTracker } from '../experience-tracker.js';
|
|
2
|
+
import type Explorer from '../explorer.js';
|
|
3
|
+
import type { KnowledgeTracker } from '../knowledge-tracker.js';
|
|
4
|
+
import { Test } from '../test-plan.js';
|
|
5
|
+
import type { Agent } from './agent.js';
|
|
6
|
+
import type { Navigator } from './navigator.js';
|
|
7
|
+
import { Provider } from './provider.js';
|
|
8
|
+
import { TaskAgent } from './task-agent.js';
|
|
9
|
+
export declare class Rerunner extends TaskAgent implements Agent {
|
|
10
|
+
readonly ACTION_TOOLS: string[];
|
|
11
|
+
emoji: string;
|
|
12
|
+
explorer: Explorer;
|
|
13
|
+
provider: Provider;
|
|
14
|
+
agentTools: any;
|
|
15
|
+
healedSteps: Array<{
|
|
16
|
+
test: string;
|
|
17
|
+
original: string;
|
|
18
|
+
healed: string;
|
|
19
|
+
}>;
|
|
20
|
+
traceDir: string;
|
|
21
|
+
constructor(explorer: Explorer, provider: Provider, agentTools?: any);
|
|
22
|
+
getNavigator(): Navigator;
|
|
23
|
+
getExperienceTracker(): ExperienceTracker;
|
|
24
|
+
getKnowledgeTracker(): KnowledgeTracker;
|
|
25
|
+
getProvider(): Provider;
|
|
26
|
+
get rerunnerConfig(): Record<string, any>;
|
|
27
|
+
get healLimit(): number;
|
|
28
|
+
get healMaxIterations(): number;
|
|
29
|
+
listTests(testsDir: string): void;
|
|
30
|
+
rerun(filePath: string, options?: {
|
|
31
|
+
testIndices?: number[];
|
|
32
|
+
}): Promise<RerunResult>;
|
|
33
|
+
getCurrentTask(testMap: Map<string, Test>): Test | undefined;
|
|
34
|
+
setupPlugins(): void;
|
|
35
|
+
teardownHealing(): void;
|
|
36
|
+
healStep(step: any, error: Error): Promise<((deps: {
|
|
37
|
+
I: any;
|
|
38
|
+
}) => Promise<void>) | null>;
|
|
39
|
+
getHealSystemPrompt(): string;
|
|
40
|
+
getHealUserPrompt(failedCode: string, error: Error): string;
|
|
41
|
+
printResults(result: RerunResult): void;
|
|
42
|
+
}
|
|
43
|
+
interface RerunResult {
|
|
44
|
+
total: number;
|
|
45
|
+
passed: number;
|
|
46
|
+
failed: number;
|
|
47
|
+
healed: number;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function clearResearchCache(): void;
|
|
2
|
+
export declare function getCachedResearch(hash: string): string;
|
|
3
|
+
export declare function getPreviousResearch(hash: string): string;
|
|
4
|
+
export declare function saveResearch(hash: string, text: string, combinedHtml?: string): string;
|
|
5
|
+
export declare function findSimilarResearch(combinedHtml: string): Promise<string | null>;
|
|
6
|
+
export declare function findSimilarStateHash(combinedHtml: string): Promise<string | null>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Page } from 'playwright';
|
|
2
|
+
import type { ActionResult } from '../../action-result.js';
|
|
3
|
+
import type Explorer from '../../explorer.js';
|
|
4
|
+
import type { Provider } from '../provider.js';
|
|
5
|
+
import { type Constructor } from './mixin.js';
|
|
6
|
+
import type { ResearchResult } from './research-result.js';
|
|
7
|
+
export declare function visuallyAnnotateContainers(page: Page, containers: Array<{
|
|
8
|
+
css: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}>): Promise<number>;
|
|
11
|
+
export declare function WithCoordinates<T extends Constructor>(Base: T): {
|
|
12
|
+
new (...args: any[]): {
|
|
13
|
+
explorer: Explorer;
|
|
14
|
+
provider: Provider;
|
|
15
|
+
actionResult: ActionResult | undefined;
|
|
16
|
+
analyzeScreenshotForVisualProps(): Promise<VisualAnalysisResult>;
|
|
17
|
+
visuallyAnnotateElements(opts?: {
|
|
18
|
+
containers?: Array<{
|
|
19
|
+
css: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}>;
|
|
22
|
+
}): Promise<number>;
|
|
23
|
+
_analyzeScreenshotForVisualProps(): Promise<VisualAnalysisResult>;
|
|
24
|
+
mergeVisualData(result: ResearchResult, visualData: Map<string, {
|
|
25
|
+
coordinates: string | null;
|
|
26
|
+
color: string | null;
|
|
27
|
+
icon: string | null;
|
|
28
|
+
}>): Promise<void>;
|
|
29
|
+
backfillCoordinates(result: ResearchResult): Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
} & T;
|
|
32
|
+
export interface VisualAnalysisResult {
|
|
33
|
+
elements: Map<string, {
|
|
34
|
+
coordinates: string | null;
|
|
35
|
+
color: string | null;
|
|
36
|
+
icon: string | null;
|
|
37
|
+
}>;
|
|
38
|
+
pagePurpose: string | null;
|
|
39
|
+
primaryActions: string[] | null;
|
|
40
|
+
focusedSection: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface CoordinateMethods {
|
|
43
|
+
analyzeScreenshotForVisualProps(): Promise<VisualAnalysisResult>;
|
|
44
|
+
mergeVisualData(result: ResearchResult, visualData: Map<string, {
|
|
45
|
+
coordinates: string | null;
|
|
46
|
+
color: string | null;
|
|
47
|
+
icon: string | null;
|
|
48
|
+
}>): Promise<void>;
|
|
49
|
+
backfillCoordinates(result: ResearchResult): Promise<void>;
|
|
50
|
+
visuallyAnnotateElements(opts?: {
|
|
51
|
+
containers?: Array<{
|
|
52
|
+
css: string;
|
|
53
|
+
label: string;
|
|
54
|
+
}>;
|
|
55
|
+
}): Promise<number>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ActionResult, type Diff } from '../../action-result.js';
|
|
2
|
+
import type Explorer from '../../explorer.js';
|
|
3
|
+
import type { StateManager } from '../../state-manager.js';
|
|
4
|
+
import { WebPageState } from '../../state-manager.js';
|
|
5
|
+
import type { Provider } from '../provider.js';
|
|
6
|
+
import { type Constructor } from './mixin.js';
|
|
7
|
+
import { type ResearchElement } from './parser.js';
|
|
8
|
+
import type { ResearchResult } from './research-result.js';
|
|
9
|
+
export declare function WithDeepAnalysis<T extends Constructor>(Base: T): {
|
|
10
|
+
new (...args: any[]): {
|
|
11
|
+
explorer: Explorer;
|
|
12
|
+
provider: Provider;
|
|
13
|
+
stateManager: StateManager;
|
|
14
|
+
actionResult: ActionResult | undefined;
|
|
15
|
+
performDeepAnalysis(state: WebPageState, result: ResearchResult): Promise<void>;
|
|
16
|
+
researchOverlay(current: ActionResult, previous: ActionResult, pageStateHash: string): Promise<string | null>;
|
|
17
|
+
_loadPreviousExtendedSections(hash: string): PreviousSection[];
|
|
18
|
+
_replayPreviousSections(state: WebPageState, prevSections: PreviousSection[], maxClicks: number): Promise<{
|
|
19
|
+
verified: string[];
|
|
20
|
+
verifiedCodes: string[];
|
|
21
|
+
missing: PreviousSection[];
|
|
22
|
+
}>;
|
|
23
|
+
_appendExtendedResearch(result: ResearchResult, expandedSections: string[], navigationLinks: Array<{
|
|
24
|
+
code: string;
|
|
25
|
+
url: string;
|
|
26
|
+
}>): void;
|
|
27
|
+
_discoverExpandables(researchText: string, missing?: PreviousSection[], verifiedCodes?: string[]): Promise<ExpandableElement[]>;
|
|
28
|
+
_buildClickCommands(el: ExpandableElement): string[];
|
|
29
|
+
_selectExpandables(expandables: ExpandableElement[], url: string, maxClicks: number): Promise<ExpandableElement[]>;
|
|
30
|
+
_clickExpandableElements(elements: Array<{
|
|
31
|
+
commands: string[];
|
|
32
|
+
description: string;
|
|
33
|
+
}>, state: WebPageState, expandedSections: string[], navigationLinks: Array<{
|
|
34
|
+
code: string;
|
|
35
|
+
url: string;
|
|
36
|
+
}>): Promise<void>;
|
|
37
|
+
_executeAndAnalyze(commands: string[], description: string, state: WebPageState, originalAria: string, alreadyExpanded: string[]): Promise<ExpansionOutcome>;
|
|
38
|
+
_restorePageState(url: string, originalAria: string): Promise<void>;
|
|
39
|
+
_analyzeExpandedAction(code: string, description: string, diff: Diff, alreadyExpanded: string[]): Promise<string | null>;
|
|
40
|
+
_deduplicateExpandedSections(sections: string[]): string[];
|
|
41
|
+
_summarizeExpanded(expandedSections: string[]): string[];
|
|
42
|
+
_sectionFingerprint(sectionMarkdown: string): string | null;
|
|
43
|
+
_parseSectionKeys(sectionMarkdown: string): {
|
|
44
|
+
name: string;
|
|
45
|
+
keys: string[];
|
|
46
|
+
} | null;
|
|
47
|
+
};
|
|
48
|
+
} & T;
|
|
49
|
+
interface ExpandableElement extends ResearchElement {
|
|
50
|
+
container: string | null;
|
|
51
|
+
}
|
|
52
|
+
interface PreviousSection {
|
|
53
|
+
name: string;
|
|
54
|
+
code: string;
|
|
55
|
+
}
|
|
56
|
+
type ExpansionOutcome = {
|
|
57
|
+
status: 'revealed';
|
|
58
|
+
code: string;
|
|
59
|
+
sectionMarkdown: string;
|
|
60
|
+
} | {
|
|
61
|
+
status: 'navigated';
|
|
62
|
+
code: string;
|
|
63
|
+
url: string;
|
|
64
|
+
} | {
|
|
65
|
+
status: 'none';
|
|
66
|
+
code: string;
|
|
67
|
+
} | {
|
|
68
|
+
status: 'failed';
|
|
69
|
+
};
|
|
70
|
+
export interface DeepAnalysisMethods {
|
|
71
|
+
performDeepAnalysis(state: WebPageState, result: ResearchResult): Promise<void>;
|
|
72
|
+
researchOverlay(current: ActionResult, previous: ActionResult, pageStateHash: string): Promise<string | null>;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Page } from 'playwright';
|
|
2
|
+
import type { ResearchSection } from './parser.js';
|
|
3
|
+
import type { ResearchResult } from './research-result.js';
|
|
4
|
+
export declare const FOCUSED_MARKER = "> **Focused**";
|
|
5
|
+
export declare function hasFocusedSection(text: string): boolean;
|
|
6
|
+
export declare function detectFocusedSection(page: Page, sections: ResearchSection[]): Promise<string | null>;
|
|
7
|
+
export declare function markSectionAsFocused(result: ResearchResult, sectionName: string): void;
|
|
8
|
+
export declare function pickDefaultFocusedSection(sections: ResearchSection[]): string | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ActionResult } from '../../action-result.js';
|
|
2
|
+
import type Explorer from '../../explorer.js';
|
|
3
|
+
import type { Conversation } from '../conversation.js';
|
|
4
|
+
import type { Provider } from '../provider.js';
|
|
5
|
+
import { type Constructor } from './mixin.js';
|
|
6
|
+
import { parseResearchSections } from './parser.js';
|
|
7
|
+
import type { ResearchResult } from './research-result.js';
|
|
8
|
+
export declare const DYNAMIC_ID_PATTERN: RegExp;
|
|
9
|
+
export declare const isForbiddenLocator: (s: string) => boolean;
|
|
10
|
+
export declare function WithLocators<T extends Constructor>(Base: T): {
|
|
11
|
+
new (...args: any[]): {
|
|
12
|
+
explorer: Explorer;
|
|
13
|
+
provider: Provider;
|
|
14
|
+
actionResult: ActionResult | undefined;
|
|
15
|
+
testLocators(locators: Locator[]): Promise<void>;
|
|
16
|
+
fixBrokenSections(result: ResearchResult, conversation: Conversation): Promise<void>;
|
|
17
|
+
backfillBrokenLocators(result: ResearchResult): Promise<void>;
|
|
18
|
+
validateContainers(result: ResearchResult): Promise<void>;
|
|
19
|
+
updateSectionContainer(result: ResearchResult, section: ReturnType<typeof parseResearchSections>[0], newCss: string | null): void;
|
|
20
|
+
};
|
|
21
|
+
} & T;
|
|
22
|
+
export interface Locator {
|
|
23
|
+
section: string;
|
|
24
|
+
container: string | null;
|
|
25
|
+
element: string;
|
|
26
|
+
type: 'css' | 'xpath' | 'aria';
|
|
27
|
+
locator: string;
|
|
28
|
+
valid: boolean | null;
|
|
29
|
+
error: string | null;
|
|
30
|
+
pwLocator: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface LocatorMethods {
|
|
33
|
+
testLocators(locators: Locator[]): Promise<void>;
|
|
34
|
+
fixBrokenSections(result: ResearchResult, conversation: Conversation): Promise<void>;
|
|
35
|
+
backfillBrokenLocators(result: ResearchResult): Promise<void>;
|
|
36
|
+
}
|