testchimp-runner-core 0.0.33 โ 0.0.35
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/execution-service.d.ts +1 -4
- package/dist/execution-service.d.ts.map +1 -1
- package/dist/execution-service.js +155 -468
- package/dist/execution-service.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/llm-facade.d.ts.map +1 -1
- package/dist/llm-facade.js +7 -7
- package/dist/llm-facade.js.map +1 -1
- package/dist/llm-provider.d.ts +9 -0
- package/dist/llm-provider.d.ts.map +1 -1
- package/dist/model-constants.d.ts +16 -5
- package/dist/model-constants.d.ts.map +1 -1
- package/dist/model-constants.js +17 -6
- package/dist/model-constants.js.map +1 -1
- package/dist/orchestrator/decision-parser.d.ts +18 -0
- package/dist/orchestrator/decision-parser.d.ts.map +1 -0
- package/dist/orchestrator/decision-parser.js +127 -0
- package/dist/orchestrator/decision-parser.js.map +1 -0
- package/dist/orchestrator/index.d.ts +4 -2
- package/dist/orchestrator/index.d.ts.map +1 -1
- package/dist/orchestrator/index.js +15 -2
- package/dist/orchestrator/index.js.map +1 -1
- package/dist/orchestrator/orchestrator-agent.d.ts +17 -22
- package/dist/orchestrator/orchestrator-agent.d.ts.map +1 -1
- package/dist/orchestrator/orchestrator-agent.js +708 -577
- package/dist/orchestrator/orchestrator-agent.js.map +1 -1
- package/dist/orchestrator/orchestrator-prompts.d.ts +32 -0
- package/dist/orchestrator/orchestrator-prompts.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator-prompts.js +737 -0
- package/dist/orchestrator/orchestrator-prompts.js.map +1 -0
- package/dist/orchestrator/page-som-handler.d.ts +106 -0
- package/dist/orchestrator/page-som-handler.d.ts.map +1 -0
- package/dist/orchestrator/page-som-handler.js +1353 -0
- package/dist/orchestrator/page-som-handler.js.map +1 -0
- package/dist/orchestrator/som-types.d.ts +149 -0
- package/dist/orchestrator/som-types.d.ts.map +1 -0
- package/dist/orchestrator/som-types.js +87 -0
- package/dist/orchestrator/som-types.js.map +1 -0
- package/dist/orchestrator/tool-registry.d.ts +2 -0
- package/dist/orchestrator/tool-registry.d.ts.map +1 -1
- package/dist/orchestrator/tool-registry.js.map +1 -1
- package/dist/orchestrator/tools/index.d.ts +5 -1
- package/dist/orchestrator/tools/index.d.ts.map +1 -1
- package/dist/orchestrator/tools/index.js +9 -2
- package/dist/orchestrator/tools/index.js.map +1 -1
- package/dist/orchestrator/tools/refresh-som-markers.d.ts +12 -0
- package/dist/orchestrator/tools/refresh-som-markers.d.ts.map +1 -0
- package/dist/orchestrator/tools/refresh-som-markers.js +64 -0
- package/dist/orchestrator/tools/refresh-som-markers.js.map +1 -0
- package/dist/orchestrator/tools/verify-action-result.d.ts +17 -0
- package/dist/orchestrator/tools/verify-action-result.d.ts.map +1 -0
- package/dist/orchestrator/tools/verify-action-result.js +140 -0
- package/dist/orchestrator/tools/verify-action-result.js.map +1 -0
- package/dist/orchestrator/tools/view-previous-screenshot.d.ts +15 -0
- package/dist/orchestrator/tools/view-previous-screenshot.d.ts.map +1 -0
- package/dist/orchestrator/tools/view-previous-screenshot.js +92 -0
- package/dist/orchestrator/tools/view-previous-screenshot.js.map +1 -0
- package/dist/orchestrator/types.d.ts +49 -1
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/orchestrator/types.js +11 -1
- package/dist/orchestrator/types.js.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +40 -34
- package/dist/prompts.js.map +1 -1
- package/dist/scenario-service.d.ts +5 -0
- package/dist/scenario-service.d.ts.map +1 -1
- package/dist/scenario-service.js +17 -0
- package/dist/scenario-service.js.map +1 -1
- package/dist/scenario-worker-class.d.ts +4 -0
- package/dist/scenario-worker-class.d.ts.map +1 -1
- package/dist/scenario-worker-class.js +21 -3
- package/dist/scenario-worker-class.js.map +1 -1
- package/dist/testing/agent-tester.d.ts +35 -0
- package/dist/testing/agent-tester.d.ts.map +1 -0
- package/dist/testing/agent-tester.js +84 -0
- package/dist/testing/agent-tester.js.map +1 -0
- package/dist/testing/ref-translator-tester.d.ts +44 -0
- package/dist/testing/ref-translator-tester.d.ts.map +1 -0
- package/dist/testing/ref-translator-tester.js +104 -0
- package/dist/testing/ref-translator-tester.js.map +1 -0
- package/dist/utils/coordinate-converter.d.ts +32 -0
- package/dist/utils/coordinate-converter.d.ts.map +1 -0
- package/dist/utils/coordinate-converter.js +130 -0
- package/dist/utils/coordinate-converter.js.map +1 -0
- package/dist/utils/hierarchical-selector.d.ts +47 -0
- package/dist/utils/hierarchical-selector.d.ts.map +1 -0
- package/dist/utils/hierarchical-selector.js +212 -0
- package/dist/utils/hierarchical-selector.js.map +1 -0
- package/dist/utils/page-info-retry.d.ts +14 -0
- package/dist/utils/page-info-retry.d.ts.map +1 -0
- package/dist/utils/page-info-retry.js +60 -0
- package/dist/utils/page-info-retry.js.map +1 -0
- package/dist/utils/page-info-utils.d.ts +1 -0
- package/dist/utils/page-info-utils.d.ts.map +1 -1
- package/dist/utils/page-info-utils.js +46 -18
- package/dist/utils/page-info-utils.js.map +1 -1
- package/dist/utils/ref-attacher.d.ts +21 -0
- package/dist/utils/ref-attacher.d.ts.map +1 -0
- package/dist/utils/ref-attacher.js +149 -0
- package/dist/utils/ref-attacher.js.map +1 -0
- package/dist/utils/ref-translator.d.ts +49 -0
- package/dist/utils/ref-translator.d.ts.map +1 -0
- package/dist/utils/ref-translator.js +276 -0
- package/dist/utils/ref-translator.js.map +1 -0
- package/package.json +1 -1
- package/plandocs/BEFORE_AFTER_VERIFICATION.md +148 -0
- package/plandocs/COORDINATE_MODE_DIAGNOSIS.md +144 -0
- package/plandocs/IMPLEMENTATION_STATUS.md +108 -0
- package/plandocs/PHASE_1_COMPLETE.md +165 -0
- package/plandocs/PHASE_1_SUMMARY.md +184 -0
- package/plandocs/PROMPT_OPTIMIZATION_ANALYSIS.md +120 -0
- package/plandocs/PROMPT_SANITY_CHECK.md +120 -0
- package/plandocs/SESSION_SUMMARY_v0.0.33.md +151 -0
- package/plandocs/TROUBLESHOOTING_SESSION.md +72 -0
- package/plandocs/VISUAL_AGENT_EVOLUTION_PLAN.md +396 -0
- package/plandocs/WHATS_NEW_v0.0.33.md +183 -0
- package/plandocs/exploratory-mode-support-v2.plan.md +953 -0
- package/plandocs/exploratory-mode-support.plan.md +928 -0
- package/plandocs/journey-id-tracking-addendum.md +227 -0
- package/src/execution-service.ts +179 -596
- package/src/index.ts +10 -0
- package/src/llm-facade.ts +8 -8
- package/src/llm-provider.ts +11 -1
- package/src/model-constants.ts +17 -5
- package/src/orchestrator/decision-parser.ts +139 -0
- package/src/orchestrator/index.ts +27 -2
- package/src/orchestrator/orchestrator-agent.ts +868 -623
- package/src/orchestrator/orchestrator-prompts.ts +786 -0
- package/src/orchestrator/page-som-handler.ts +1565 -0
- package/src/orchestrator/som-types.ts +188 -0
- package/src/orchestrator/tool-registry.ts +2 -0
- package/src/orchestrator/tools/index.ts +5 -1
- package/src/orchestrator/tools/refresh-som-markers.ts +69 -0
- package/src/orchestrator/tools/verify-action-result.ts +159 -0
- package/src/orchestrator/tools/view-previous-screenshot.ts +103 -0
- package/src/orchestrator/types.ts +95 -4
- package/src/prompts.ts +40 -34
- package/src/scenario-service.ts +20 -0
- package/src/scenario-worker-class.ts +30 -4
- package/src/utils/coordinate-converter.ts +162 -0
- package/src/utils/page-info-retry.ts +65 -0
- package/src/utils/page-info-utils.ts +53 -18
- package/testchimp-runner-core-0.0.35.tgz +0 -0
- /package/{CREDIT_CALLBACK_ARCHITECTURE.md โ plandocs/CREDIT_CALLBACK_ARCHITECTURE.md} +0 -0
- /package/{INTEGRATION_COMPLETE.md โ plandocs/INTEGRATION_COMPLETE.md} +0 -0
- /package/{VISION_DIAGNOSTICS_IMPROVEMENTS.md โ plandocs/VISION_DIAGNOSTICS_IMPROVEMENTS.md} +0 -0
- /package/{RELEASE_0.0.26.md โ releasenotes/RELEASE_0.0.26.md} +0 -0
- /package/{RELEASE_0.0.27.md โ releasenotes/RELEASE_0.0.27.md} +0 -0
- /package/{RELEASE_0.0.28.md โ releasenotes/RELEASE_0.0.28.md} +0 -0
package/src/index.ts
CHANGED
|
@@ -45,6 +45,7 @@ export {
|
|
|
45
45
|
SelfReflection,
|
|
46
46
|
ToolCall,
|
|
47
47
|
ToolResult,
|
|
48
|
+
ExplorationMode,
|
|
48
49
|
DEFAULT_AGENT_CONFIG,
|
|
49
50
|
// Tools (information-gathering only)
|
|
50
51
|
TakeScreenshotTool,
|
|
@@ -58,6 +59,9 @@ export {
|
|
|
58
59
|
export * from './types';
|
|
59
60
|
export { PageInfo, InteractiveElement } from './utils/page-info-utils';
|
|
60
61
|
|
|
62
|
+
// Model constants
|
|
63
|
+
export { DEFAULT_MODEL, DEFAULT_SIMPLER_MODEL, VISION_MODEL } from './model-constants';
|
|
64
|
+
|
|
61
65
|
// Authentication
|
|
62
66
|
export * from './auth-config';
|
|
63
67
|
|
|
@@ -359,6 +363,12 @@ export class TestChimpService {
|
|
|
359
363
|
return this.executeScript(repairRequest);
|
|
360
364
|
}
|
|
361
365
|
|
|
366
|
+
// Exploration mode execution
|
|
367
|
+
async executeExploration(page: any, explorationConfig: any, jobId: string): Promise<any> {
|
|
368
|
+
// Delegate to scenario service's orchestrator
|
|
369
|
+
return this.scenarioService.executeExploration(page, explorationConfig, jobId);
|
|
370
|
+
}
|
|
371
|
+
|
|
362
372
|
// Credit usage reporting methods
|
|
363
373
|
async reportScriptGenerationCredit(jobId?: string): Promise<void> {
|
|
364
374
|
return this.creditUsageService.reportScriptGenerationCredit(jobId);
|
package/src/llm-facade.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PROMPTS } from './prompts';
|
|
2
2
|
import { PageInfo } from './utils/page-info-utils';
|
|
3
3
|
import { StepOperation } from './types';
|
|
4
|
-
import { DEFAULT_MODEL, VISION_MODEL } from './model-constants';
|
|
4
|
+
import { DEFAULT_MODEL, DEFAULT_SIMPLER_MODEL, VISION_MODEL } from './model-constants';
|
|
5
5
|
import { LLMProvider, LLMRequest, LLMResponse } from './llm-provider';
|
|
6
6
|
|
|
7
7
|
// LLM Response interfaces
|
|
@@ -140,7 +140,7 @@ export class LLMFacade {
|
|
|
140
140
|
/**
|
|
141
141
|
* Generate a test name from scenario description
|
|
142
142
|
*/
|
|
143
|
-
async generateTestName(scenario: string, model: string =
|
|
143
|
+
async generateTestName(scenario: string, model: string = DEFAULT_SIMPLER_MODEL): Promise<string> {
|
|
144
144
|
this.log('Generating test name with LLM...');
|
|
145
145
|
|
|
146
146
|
const request: LLMRequest = {
|
|
@@ -163,7 +163,7 @@ export class LLMFacade {
|
|
|
163
163
|
/**
|
|
164
164
|
* Generate hashtags for semantic grouping
|
|
165
165
|
*/
|
|
166
|
-
async generateHashtags(scenario: string, model: string =
|
|
166
|
+
async generateHashtags(scenario: string, model: string = DEFAULT_SIMPLER_MODEL): Promise<string[]> {
|
|
167
167
|
this.log('Generating hashtags with LLM...');
|
|
168
168
|
|
|
169
169
|
const request: LLMRequest = {
|
|
@@ -280,7 +280,7 @@ Respond ONLY with valid JSON:
|
|
|
280
280
|
errorMessage: string,
|
|
281
281
|
attemptCount: number,
|
|
282
282
|
pageInfo: any,
|
|
283
|
-
model: string =
|
|
283
|
+
model: string = DEFAULT_SIMPLER_MODEL
|
|
284
284
|
): Promise<ScreenshotNeedResponse> {
|
|
285
285
|
this.log('Assessing screenshot need with LLM...');
|
|
286
286
|
|
|
@@ -479,7 +479,7 @@ Respond ONLY with valid JSON:
|
|
|
479
479
|
/**
|
|
480
480
|
* Break down scenario into steps
|
|
481
481
|
*/
|
|
482
|
-
async breakdownScenario(scenario: string, model: string =
|
|
482
|
+
async breakdownScenario(scenario: string, model: string = DEFAULT_SIMPLER_MODEL): Promise<ScenarioStep[]> {
|
|
483
483
|
this.log('Breaking down scenario with LLM...');
|
|
484
484
|
this.log(`๐ INPUT SCENARIO: ${scenario}`);
|
|
485
485
|
|
|
@@ -571,7 +571,7 @@ Respond ONLY with valid JSON:
|
|
|
571
571
|
/**
|
|
572
572
|
* Parse script into steps for AI repair
|
|
573
573
|
*/
|
|
574
|
-
async parseScriptIntoSteps(script: string, model: string =
|
|
574
|
+
async parseScriptIntoSteps(script: string, model: string = DEFAULT_SIMPLER_MODEL): Promise<Array<{ description: string; code: string; success?: boolean; error?: string }>> {
|
|
575
575
|
this.log('Parsing script into steps with LLM...');
|
|
576
576
|
|
|
577
577
|
const request: LLMRequest = {
|
|
@@ -657,7 +657,7 @@ Respond ONLY with valid JSON:
|
|
|
657
657
|
async assessRepairConfidence(
|
|
658
658
|
originalScript: string,
|
|
659
659
|
updatedScript: string,
|
|
660
|
-
model: string =
|
|
660
|
+
model: string = DEFAULT_SIMPLER_MODEL
|
|
661
661
|
): Promise<RepairConfidenceResponse> {
|
|
662
662
|
const request: LLMRequest = {
|
|
663
663
|
model,
|
|
@@ -676,7 +676,7 @@ Respond ONLY with valid JSON:
|
|
|
676
676
|
originalScript: string,
|
|
677
677
|
updatedScript: string,
|
|
678
678
|
newRepairAdvice: string,
|
|
679
|
-
model: string =
|
|
679
|
+
model: string = DEFAULT_SIMPLER_MODEL
|
|
680
680
|
): Promise<string> {
|
|
681
681
|
const request: LLMRequest = {
|
|
682
682
|
model,
|
package/src/llm-provider.ts
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
* Abstraction for LLM calls - allows different implementations (backend proxy, local, etc.)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Labeled image for multi-image LLM requests
|
|
8
|
+
* Used for before/after comparisons or multi-screenshot analysis
|
|
9
|
+
*/
|
|
10
|
+
export interface LabeledImage {
|
|
11
|
+
label: string; // e.g., "Before", "After", "Screenshot 1"
|
|
12
|
+
dataUrl: string; // Base64 data URL (data:image/png;base64,...)
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
/**
|
|
7
16
|
* LLM request - camelCase for TypeScript
|
|
8
17
|
*/
|
|
@@ -10,7 +19,8 @@ export interface LLMRequest {
|
|
|
10
19
|
model?: string;
|
|
11
20
|
systemPrompt?: string;
|
|
12
21
|
userPrompt?: string;
|
|
13
|
-
imageUrl?: string;
|
|
22
|
+
imageUrl?: string; // For vision models (data URL) - backward compatible, single image
|
|
23
|
+
images?: LabeledImage[]; // For multi-image requests (e.g., before/after comparison)
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
/**
|
package/src/model-constants.ts
CHANGED
|
@@ -5,14 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Default model for
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
8
|
+
* Default model for complex reasoning tasks:
|
|
9
|
+
* - Command generation (Playwright selectors)
|
|
10
|
+
* - Goal completion checks (critical decisions)
|
|
11
|
+
* - Repair suggestions (complex logic)
|
|
12
|
+
* - Agent orchestration (decision-making)
|
|
13
13
|
*/
|
|
14
14
|
export const DEFAULT_MODEL = 'gpt-5-mini';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Simpler model for structured/guided tasks:
|
|
18
|
+
* - Scenario breakdown (structured splitting)
|
|
19
|
+
* - Screenshot need assessment (yes/no decision)
|
|
20
|
+
* - Repair confidence assessment (comparison task)
|
|
21
|
+
* - Test name generation (text formatting)
|
|
22
|
+
* - Hashtag generation (semantic tags)
|
|
23
|
+
* - Script parsing (extract steps)
|
|
24
|
+
* - Final script merging (text concatenation)
|
|
25
|
+
*/
|
|
26
|
+
export const DEFAULT_SIMPLER_MODEL = 'gpt-4o-mini';
|
|
27
|
+
|
|
16
28
|
/**
|
|
17
29
|
* Vision-capable model for visual diagnostics:
|
|
18
30
|
* - Screenshot analysis
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision Parser Utility
|
|
3
|
+
* Parses and validates agent decisions from LLM responses
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AgentDecision } from './types';
|
|
7
|
+
import { isSomVerification, isSomCommand } from './som-types';
|
|
8
|
+
|
|
9
|
+
export class DecisionParser {
|
|
10
|
+
private logger?: (message: string, level?: 'log' | 'error' | 'warn') => void;
|
|
11
|
+
|
|
12
|
+
constructor(logger?: (message: string, level?: 'log' | 'error' | 'warn') => void) {
|
|
13
|
+
this.logger = logger;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Parse agent decision from LLM response
|
|
18
|
+
*/
|
|
19
|
+
parse(response: string): AgentDecision {
|
|
20
|
+
try {
|
|
21
|
+
// Extract JSON from response
|
|
22
|
+
const jsonMatch = response.match(/\{[\s\S]*\}/);
|
|
23
|
+
if (!jsonMatch) {
|
|
24
|
+
this.logger?.(`[DecisionParser] โ No JSON found in LLM response`, 'error');
|
|
25
|
+
this.logger?.(`[DecisionParser] ๐ FULL LLM RESPONSE:\n${response}`, 'error');
|
|
26
|
+
throw new Error('No JSON found in response');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
30
|
+
|
|
31
|
+
// Validate required fields
|
|
32
|
+
// Accept either "reasoning" or "statusReasoning" (LLMs sometimes only provide one)
|
|
33
|
+
if (!parsed.status || (!parsed.reasoning && !parsed.statusReasoning)) {
|
|
34
|
+
this.logger?.(`[DecisionParser] โ Missing required fields in parsed JSON`, 'error');
|
|
35
|
+
this.logger?.(`[DecisionParser] ๐ FULL LLM RESPONSE:\n${response}`, 'error');
|
|
36
|
+
this.logger?.(`[DecisionParser] ๐ PARSED JSON:\n${JSON.stringify(parsed, null, 2)}`, 'error');
|
|
37
|
+
this.logger?.(`[DecisionParser] โ Has status: ${!!parsed.status}, Has reasoning: ${!!parsed.reasoning}, Has statusReasoning: ${!!parsed.statusReasoning}`, 'error');
|
|
38
|
+
throw new Error('Missing required fields: status and (reasoning or statusReasoning)');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Normalize: if reasoning is missing but statusReasoning exists, use statusReasoning as reasoning
|
|
42
|
+
if (!parsed.reasoning && parsed.statusReasoning) {
|
|
43
|
+
parsed.reasoning = parsed.statusReasoning;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return parsed as AgentDecision;
|
|
47
|
+
|
|
48
|
+
} catch (error: any) {
|
|
49
|
+
this.logger?.(`[DecisionParser] โ Failed to parse agent decision: ${error.message}`, 'error');
|
|
50
|
+
|
|
51
|
+
// Only log full response if not already logged above
|
|
52
|
+
if (!error.message.includes('Missing required fields') && !error.message.includes('No JSON found')) {
|
|
53
|
+
this.logger?.(`[DecisionParser] ๐ FULL LLM RESPONSE:\n${response}`, 'error');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Return fallback
|
|
57
|
+
return {
|
|
58
|
+
status: 'stuck',
|
|
59
|
+
statusReasoning: 'Failed to parse agent response',
|
|
60
|
+
reasoning: `Parse error: ${error.message}`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Log agent decision for debugging
|
|
67
|
+
*/
|
|
68
|
+
log(decision: AgentDecision, iteration: number): void {
|
|
69
|
+
this.logger?.(`[Orchestrator] ๐ญ REASONING: ${decision.reasoning}`);
|
|
70
|
+
|
|
71
|
+
if (decision.selfReflection) {
|
|
72
|
+
this.logger?.(`[Orchestrator] ๐ง SELF-REFLECTION:`);
|
|
73
|
+
this.logger?.(`[Orchestrator] Next: ${decision.selfReflection.guidanceForNext}`);
|
|
74
|
+
if (decision.selfReflection.detectingLoop) {
|
|
75
|
+
this.logger?.(`[Orchestrator] ๐ LOOP DETECTED: ${decision.selfReflection.loopReasoning}`, 'warn');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (decision.toolCalls && decision.toolCalls.length > 0) {
|
|
80
|
+
this.logger?.(`[Orchestrator] ๐ง TOOLS: ${decision.toolCalls.map(t => t.name).join(', ')}`);
|
|
81
|
+
if (decision.toolReasoning) {
|
|
82
|
+
this.logger?.(`[Orchestrator] ๐ Why: ${decision.toolReasoning}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (decision.blockerDetected) {
|
|
87
|
+
this.logger?.(`[Orchestrator] ๐ง BLOCKER: ${decision.blockerDetected.description}`, 'warn');
|
|
88
|
+
this.logger?.(`[Orchestrator] ๐งน Clearing with ${decision.blockerDetected.clearingCommands.length} command(s)`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (decision.stepReEvaluation?.detected) {
|
|
92
|
+
this.logger?.(`[Orchestrator] ๐ STEP RE-EVALUATION: ${decision.stepReEvaluation.issue}`, 'warn');
|
|
93
|
+
this.logger?.(`[Orchestrator] ๐ Explanation: ${decision.stepReEvaluation.explanation}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (decision.commands && decision.commands.length > 0) {
|
|
97
|
+
this.logger?.(`[Orchestrator] ๐ COMMANDS (${decision.commands.length}):`);
|
|
98
|
+
decision.commands.slice(0, 3).forEach((cmd: any, i) => {
|
|
99
|
+
// Handle string commands (standard mode), SomCommand, and SomVerification objects
|
|
100
|
+
if (typeof cmd === 'string') {
|
|
101
|
+
this.logger?.(`[Orchestrator] ${i + 1}. ${cmd.substring(0, 80)}...`);
|
|
102
|
+
} else if (isSomVerification(cmd)) {
|
|
103
|
+
const ref = cmd.elementRef || cmd.selector || 'unknown';
|
|
104
|
+
this.logger?.(`[Orchestrator] ${i + 1}. [VERIFY] ${cmd.verificationType} on ${ref}: ${cmd.expected}`);
|
|
105
|
+
} else if (isSomCommand(cmd)) {
|
|
106
|
+
this.logger?.(`[Orchestrator] ${i + 1}. [ACTION] ${cmd.action} on ${cmd.elementRef || 'coord'}`);
|
|
107
|
+
} else {
|
|
108
|
+
this.logger?.(`[Orchestrator] ${i + 1}. ${JSON.stringify(cmd).substring(0, 80)}...`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (decision.commands.length > 3) {
|
|
112
|
+
this.logger?.(`[Orchestrator] ... and ${decision.commands.length - 3} more`);
|
|
113
|
+
}
|
|
114
|
+
if (decision.commandReasoning) {
|
|
115
|
+
this.logger?.(`[Orchestrator] ๐ก Why: ${decision.commandReasoning}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Log meta-learning suggestions with clear demarcations
|
|
120
|
+
if (decision.debugInfo?.suggestedPromptUpdates) {
|
|
121
|
+
this.logger?.(``, 'warn');
|
|
122
|
+
this.logger?.(`โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ`, 'warn');
|
|
123
|
+
this.logger?.(`[Orchestrator] ๐ง META-LEARNING SUGGESTION FROM AGENT`, 'warn');
|
|
124
|
+
this.logger?.(`โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ`, 'warn');
|
|
125
|
+
this.logger?.(``, 'warn');
|
|
126
|
+
this.logger?.(`SUGGESTED PROMPT UPDATE:`, 'warn');
|
|
127
|
+
this.logger?.(` ${decision.debugInfo.suggestedPromptUpdates}`, 'warn');
|
|
128
|
+
this.logger?.(``, 'warn');
|
|
129
|
+
if (decision.debugInfo.reasoning) {
|
|
130
|
+
this.logger?.(`REASONING:`, 'warn');
|
|
131
|
+
this.logger?.(` ${decision.debugInfo.reasoning}`, 'warn');
|
|
132
|
+
this.logger?.(``, 'warn');
|
|
133
|
+
}
|
|
134
|
+
this.logger?.(`โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ`, 'warn');
|
|
135
|
+
this.logger?.(``, 'warn');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
@@ -5,16 +5,22 @@
|
|
|
5
5
|
// Core orchestrator
|
|
6
6
|
export { OrchestratorAgent } from './orchestrator-agent';
|
|
7
7
|
|
|
8
|
+
// SoM (Set-of-Marks) handler
|
|
9
|
+
export { PageSoMHandler } from './page-som-handler';
|
|
10
|
+
|
|
8
11
|
// Tool system
|
|
9
12
|
export { ToolRegistry, Tool, ToolParameter, ToolExecutionContext } from './tool-registry';
|
|
10
13
|
|
|
11
|
-
//
|
|
14
|
+
// 8 information-gathering tools (state changes via Playwright commands)
|
|
12
15
|
export {
|
|
13
16
|
TakeScreenshotTool,
|
|
17
|
+
ViewPreviousScreenshotTool,
|
|
18
|
+
RefreshSomMarkersTool,
|
|
14
19
|
RecallHistoryTool,
|
|
15
20
|
InspectPageTool,
|
|
16
21
|
CheckPageReadyTool,
|
|
17
|
-
ExtractDataTool
|
|
22
|
+
ExtractDataTool,
|
|
23
|
+
VerifyActionResultTool
|
|
18
24
|
} from './tools';
|
|
19
25
|
|
|
20
26
|
// Types
|
|
@@ -28,6 +34,25 @@ export {
|
|
|
28
34
|
SelfReflection,
|
|
29
35
|
ToolCall,
|
|
30
36
|
ToolResult,
|
|
37
|
+
ExplorationMode,
|
|
31
38
|
DEFAULT_AGENT_CONFIG
|
|
32
39
|
} from './types';
|
|
33
40
|
|
|
41
|
+
// SoM Types
|
|
42
|
+
export {
|
|
43
|
+
SomCommand,
|
|
44
|
+
SomElement,
|
|
45
|
+
SemanticCommandResult,
|
|
46
|
+
CommandRunStatus,
|
|
47
|
+
CommandAttempt,
|
|
48
|
+
DomMutation,
|
|
49
|
+
InteractionAction,
|
|
50
|
+
Coordinate,
|
|
51
|
+
TypedSelector,
|
|
52
|
+
SomVerification,
|
|
53
|
+
VerificationType,
|
|
54
|
+
SomCommandOrVerification,
|
|
55
|
+
isSomVerification,
|
|
56
|
+
isSomCommand
|
|
57
|
+
} from './som-types';
|
|
58
|
+
|