explorbot 0.1.31 → 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.
Files changed (177) hide show
  1. package/dist/boat/api-tester/example/apibot.config.js +30 -0
  2. package/dist/package.json +10 -25
  3. package/dist/src/action-result.d.ts +133 -0
  4. package/dist/src/action-result.js +22 -7
  5. package/dist/src/action.d.ts +50 -0
  6. package/dist/src/action.js +10 -5
  7. package/dist/src/activity.d.ts +26 -0
  8. package/dist/src/ai/agent.d.ts +3 -0
  9. package/dist/src/ai/captain/file-tools.d.ts +28 -0
  10. package/dist/src/ai/captain/idle-mode.d.ts +11 -0
  11. package/dist/src/ai/captain/mixin.d.ts +10 -0
  12. package/dist/src/ai/captain/test-mode.d.ts +13 -0
  13. package/dist/src/ai/captain/web-mode.d.ts +13 -0
  14. package/dist/src/ai/captain.d.ts +143 -0
  15. package/dist/src/ai/conversation.d.ts +31 -0
  16. package/dist/src/ai/driller.d.ts +161 -0
  17. package/dist/src/ai/experience-compactor.d.ts +53 -0
  18. package/dist/src/ai/fisherman-tools.d.ts +90 -0
  19. package/dist/src/ai/fisherman.d.ts +30 -0
  20. package/dist/src/ai/historian/codeceptjs.d.ts +15 -0
  21. package/dist/src/ai/historian/experience.d.ts +40 -0
  22. package/dist/src/ai/historian/mixin.d.ts +2 -0
  23. package/dist/src/ai/historian/playwright.d.ts +20 -0
  24. package/dist/src/ai/historian/screencast.d.ts +32 -0
  25. package/dist/src/ai/historian/utils.d.ts +4 -0
  26. package/dist/src/ai/historian.d.ts +108 -0
  27. package/dist/src/ai/navigator.d.ts +56 -0
  28. package/dist/src/ai/pilot.d.ts +83 -0
  29. package/dist/src/ai/planner/session-dedup.d.ts +12 -0
  30. package/dist/src/ai/planner/styles.d.ts +6 -0
  31. package/dist/src/ai/planner/subpages.d.ts +35 -0
  32. package/dist/src/ai/planner.d.ts +79 -0
  33. package/dist/src/ai/provider.d.ts +50 -0
  34. package/dist/src/ai/provider.js +10 -3
  35. package/dist/src/ai/quartermaster.d.ts +57 -0
  36. package/dist/src/ai/rerunner.d.ts +49 -0
  37. package/dist/src/ai/researcher/cache.d.ts +6 -0
  38. package/dist/src/ai/researcher/coordinates.d.ts +56 -0
  39. package/dist/src/ai/researcher/deep-analysis.d.ts +74 -0
  40. package/dist/src/ai/researcher/fingerprint-worker.d.ts +1 -0
  41. package/dist/src/ai/researcher/focus.d.ts +8 -0
  42. package/dist/src/ai/researcher/locators.d.ts +36 -0
  43. package/dist/src/ai/researcher/mixin.d.ts +2 -0
  44. package/dist/src/ai/researcher/parser.d.ts +35 -0
  45. package/dist/src/ai/researcher/research-result.d.ts +16 -0
  46. package/dist/src/ai/researcher/sections.d.ts +19 -0
  47. package/dist/src/ai/rules.d.ts +15 -0
  48. package/dist/src/ai/session-analyst.d.ts +11 -0
  49. package/dist/src/ai/task-agent.d.ts +28 -0
  50. package/dist/src/ai/tester.d.ts +103 -0
  51. package/dist/src/ai/tools.d.ts +41 -0
  52. package/dist/src/api/api-client.d.ts +17 -0
  53. package/dist/src/api/request-result.d.ts +44 -0
  54. package/dist/src/api/request-store.d.ts +29 -0
  55. package/dist/src/api/spec-reader.d.ts +5 -0
  56. package/dist/src/api/xhr-capture.d.ts +10 -0
  57. package/dist/src/browser-server.d.ts +10 -0
  58. package/dist/src/command-handler.d.ts +68 -0
  59. package/dist/src/commands/add-rule-command.d.ts +11 -0
  60. package/dist/src/commands/base-command.d.ts +26 -0
  61. package/dist/src/commands/clean-command.d.ts +12 -0
  62. package/dist/src/commands/compact-command.d.ts +20 -0
  63. package/dist/src/commands/context-aria-command.d.ts +6 -0
  64. package/dist/src/commands/context-command.d.ts +11 -0
  65. package/dist/src/commands/context-data-command.d.ts +6 -0
  66. package/dist/src/commands/context-experience-command.d.ts +6 -0
  67. package/dist/src/commands/context-html-command.d.ts +6 -0
  68. package/dist/src/commands/context-knowledge-command.d.ts +6 -0
  69. package/dist/src/commands/debug-command.d.ts +6 -0
  70. package/dist/src/commands/drill-command.d.ts +10 -0
  71. package/dist/src/commands/exit-command.d.ts +7 -0
  72. package/dist/src/commands/experience-command.d.ts +15 -0
  73. package/dist/src/commands/explore-command.d.ts +51 -0
  74. package/dist/src/commands/freesail-command.d.ts +12 -0
  75. package/dist/src/commands/help-command.d.ts +6 -0
  76. package/dist/src/commands/index.d.ts +4 -0
  77. package/dist/src/commands/init-command.d.ts +7 -0
  78. package/dist/src/commands/knows-command.d.ts +10 -0
  79. package/dist/src/commands/learn-command.d.ts +7 -0
  80. package/dist/src/commands/navigate-command.d.ts +7 -0
  81. package/dist/src/commands/path-command.d.ts +10 -0
  82. package/dist/src/commands/plan-clear-command.d.ts +7 -0
  83. package/dist/src/commands/plan-command.d.ts +14 -0
  84. package/dist/src/commands/plan-edit-command.d.ts +7 -0
  85. package/dist/src/commands/plan-load-command.d.ts +7 -0
  86. package/dist/src/commands/plan-reload-command.d.ts +7 -0
  87. package/dist/src/commands/plan-save-command.d.ts +7 -0
  88. package/dist/src/commands/plans-command.d.ts +21 -0
  89. package/dist/src/commands/rerun-command.d.ts +7 -0
  90. package/dist/src/commands/research-command.d.ts +11 -0
  91. package/dist/src/commands/runs-command.d.ts +7 -0
  92. package/dist/src/commands/start-command.d.ts +7 -0
  93. package/dist/src/commands/status-command.d.ts +6 -0
  94. package/dist/src/commands/test-command.d.ts +11 -0
  95. package/dist/src/components/ActivityPane.d.ts +6 -0
  96. package/dist/src/components/AddKnowledge.d.ts +8 -0
  97. package/dist/src/components/AddRule.d.ts +9 -0
  98. package/dist/src/components/App.d.ts +9 -0
  99. package/dist/src/components/Autocomplete.d.ts +3 -0
  100. package/dist/src/components/InputPane.d.ts +13 -0
  101. package/dist/src/components/InputReadline.d.ts +17 -0
  102. package/dist/src/components/LogPane.d.ts +6 -0
  103. package/dist/src/components/PlanEditor.d.ts +9 -0
  104. package/dist/src/components/PlanPane.d.ts +13 -0
  105. package/dist/src/components/SessionTimer.d.ts +6 -0
  106. package/dist/src/components/StateTransitionPane.d.ts +8 -0
  107. package/dist/src/components/StatusPane.d.ts +4 -0
  108. package/dist/src/components/TaskPane.d.ts +9 -0
  109. package/dist/src/components/Welcome.d.ts +3 -0
  110. package/dist/src/components/WelcomeChecklist.d.ts +9 -0
  111. package/dist/src/components/WelcomeCommands.d.ts +6 -0
  112. package/dist/src/components/autocomplete-store.d.ts +10 -0
  113. package/dist/src/components/parse-keypress.d.ts +12 -0
  114. package/dist/src/config.d.ts +251 -0
  115. package/dist/src/execution-controller.d.ts +25 -0
  116. package/dist/src/experience-tracker.d.ts +107 -0
  117. package/dist/src/experience-tracker.js +2 -1
  118. package/dist/src/explorbot.d.ts +107 -0
  119. package/dist/src/explorer.d.ts +140 -0
  120. package/dist/src/explorer.js +13 -9
  121. package/dist/src/index.d.ts +6 -0
  122. package/dist/src/index.js +2 -55
  123. package/dist/src/knowledge-tracker.d.ts +33 -0
  124. package/dist/src/knowledge-tracker.js +9 -2
  125. package/dist/src/observability.d.ts +13 -0
  126. package/dist/src/observability.js +2 -1
  127. package/dist/src/playwright-recorder.d.ts +31 -0
  128. package/dist/src/reporter.d.ts +34 -0
  129. package/dist/src/state-manager.d.ts +185 -0
  130. package/dist/src/state-manager.js +0 -7
  131. package/dist/src/stats.d.ts +24 -0
  132. package/dist/src/suite.d.ts +24 -0
  133. package/dist/src/test-plan.d.ts +166 -0
  134. package/dist/src/utils/aria.d.ts +20 -0
  135. package/dist/src/utils/browser-errors.d.ts +8 -0
  136. package/dist/src/utils/cli-name.d.ts +1 -0
  137. package/dist/src/utils/code-extractor.d.ts +1 -0
  138. package/dist/src/utils/context-formatter.d.ts +25 -0
  139. package/dist/src/utils/error-page.d.ts +12 -0
  140. package/dist/src/utils/expandable.d.ts +4 -0
  141. package/dist/src/utils/hooks-runner.d.ts +15 -0
  142. package/dist/src/utils/html-diff.d.ts +19 -0
  143. package/dist/src/utils/html.d.ts +124 -0
  144. package/dist/src/utils/log-filters.d.ts +6 -0
  145. package/dist/src/utils/logger.d.ts +35 -0
  146. package/dist/src/utils/loop.d.ts +35 -0
  147. package/dist/src/utils/markdown-parser.d.ts +17 -0
  148. package/dist/src/utils/markdown-query.d.ts +40 -0
  149. package/dist/src/utils/markdown-terminal.d.ts +1 -0
  150. package/dist/src/utils/next-steps.d.ts +11 -0
  151. package/dist/src/utils/page-readiness.d.ts +6 -0
  152. package/dist/src/utils/research-parser.d.ts +1 -0
  153. package/dist/src/utils/retry.d.ts +8 -0
  154. package/dist/src/utils/rules-loader.d.ts +12 -0
  155. package/dist/src/utils/secrets.d.ts +4 -0
  156. package/dist/src/utils/secrets.js +28 -0
  157. package/dist/src/utils/step-analyzer.d.ts +11 -0
  158. package/dist/src/utils/strings.d.ts +3 -0
  159. package/dist/src/utils/test-files.d.ts +3 -0
  160. package/dist/src/utils/test-plan-markdown.d.ts +9 -0
  161. package/dist/src/utils/throttle.d.ts +2 -0
  162. package/dist/src/utils/unique-names.d.ts +2 -0
  163. package/dist/src/utils/url-matcher.d.ts +6 -0
  164. package/dist/src/utils/web-element.d.ts +44 -0
  165. package/dist/src/utils/xpath.d.ts +17 -0
  166. package/package.json +10 -25
  167. package/src/action-result.ts +22 -7
  168. package/src/action.ts +12 -5
  169. package/src/ai/provider.ts +10 -3
  170. package/src/experience-tracker.ts +2 -1
  171. package/src/explorer.ts +14 -9
  172. package/src/index.ts +9 -0
  173. package/src/knowledge-tracker.ts +7 -1
  174. package/src/observability.ts +2 -1
  175. package/src/state-manager.ts +0 -8
  176. package/src/utils/secrets.ts +29 -0
  177. 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,6 @@
1
+ export declare function getStyles(): Record<string, string>;
2
+ export declare function getActiveStyle(iteration: number, override?: string): {
3
+ name: string;
4
+ approach: string;
5
+ };
6
+ export declare function clearStyleCache(): 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 };
@@ -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 {
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ export type Constructor<T = object> = new (...args: any[]) => T;
2
+ export declare const debugLog: (...args: any[]) => void;
@@ -0,0 +1,35 @@
1
+ export interface ResearchElement {
2
+ name: string;
3
+ type: string | null;
4
+ aria: {
5
+ role: string;
6
+ text: string;
7
+ } | null;
8
+ css: string | null;
9
+ xpath: string | null;
10
+ coordinates: string | null;
11
+ color: string | null;
12
+ icon: string | null;
13
+ eidx: string | null;
14
+ }
15
+ export interface ResearchSection {
16
+ name: string;
17
+ containerCss: string | null;
18
+ elements: ResearchElement[];
19
+ rawMarkdown: string;
20
+ isExtended: boolean;
21
+ }
22
+ export declare const RESEARCH_COLUMN_ORDER: string[];
23
+ export declare function mapRowToElement(row: Record<string, string>): ResearchElement | null;
24
+ export declare function extractContainerFromBlockquote(sectionMarkdown: string): string | null;
25
+ export declare function parseResearchSections(markdown: string): ResearchSection[];
26
+ export declare function extractValidContainers(researchText: string, opts?: {
27
+ exclude?: string[];
28
+ }): Array<{
29
+ css: string;
30
+ label: string;
31
+ }>;
32
+ export declare function rebuildSectionMarkdown(section: ResearchSection): string;
33
+ export declare function formatResearchSummary(text: string, opts?: {
34
+ visionUsed?: boolean;
35
+ }): string;