testchimp-runner-core 0.0.34 → 0.0.36

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 (150) hide show
  1. package/dist/execution-service.d.ts +1 -4
  2. package/dist/execution-service.d.ts.map +1 -1
  3. package/dist/execution-service.js +155 -468
  4. package/dist/execution-service.js.map +1 -1
  5. package/dist/index.d.ts +3 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +11 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/orchestrator/decision-parser.d.ts +18 -0
  10. package/dist/orchestrator/decision-parser.d.ts.map +1 -0
  11. package/dist/orchestrator/decision-parser.js +127 -0
  12. package/dist/orchestrator/decision-parser.js.map +1 -0
  13. package/dist/orchestrator/index.d.ts +4 -2
  14. package/dist/orchestrator/index.d.ts.map +1 -1
  15. package/dist/orchestrator/index.js +14 -2
  16. package/dist/orchestrator/index.js.map +1 -1
  17. package/dist/orchestrator/orchestrator-agent.d.ts +17 -14
  18. package/dist/orchestrator/orchestrator-agent.d.ts.map +1 -1
  19. package/dist/orchestrator/orchestrator-agent.js +534 -204
  20. package/dist/orchestrator/orchestrator-agent.js.map +1 -1
  21. package/dist/orchestrator/orchestrator-prompts.d.ts +14 -2
  22. package/dist/orchestrator/orchestrator-prompts.d.ts.map +1 -1
  23. package/dist/orchestrator/orchestrator-prompts.js +529 -247
  24. package/dist/orchestrator/orchestrator-prompts.js.map +1 -1
  25. package/dist/orchestrator/page-som-handler.d.ts +106 -0
  26. package/dist/orchestrator/page-som-handler.d.ts.map +1 -0
  27. package/dist/orchestrator/page-som-handler.js +1353 -0
  28. package/dist/orchestrator/page-som-handler.js.map +1 -0
  29. package/dist/orchestrator/som-types.d.ts +149 -0
  30. package/dist/orchestrator/som-types.d.ts.map +1 -0
  31. package/dist/orchestrator/som-types.js +87 -0
  32. package/dist/orchestrator/som-types.js.map +1 -0
  33. package/dist/orchestrator/tool-registry.d.ts +2 -0
  34. package/dist/orchestrator/tool-registry.d.ts.map +1 -1
  35. package/dist/orchestrator/tool-registry.js.map +1 -1
  36. package/dist/orchestrator/tools/index.d.ts +4 -1
  37. package/dist/orchestrator/tools/index.d.ts.map +1 -1
  38. package/dist/orchestrator/tools/index.js +7 -2
  39. package/dist/orchestrator/tools/index.js.map +1 -1
  40. package/dist/orchestrator/tools/refresh-som-markers.d.ts +12 -0
  41. package/dist/orchestrator/tools/refresh-som-markers.d.ts.map +1 -0
  42. package/dist/orchestrator/tools/refresh-som-markers.js +64 -0
  43. package/dist/orchestrator/tools/refresh-som-markers.js.map +1 -0
  44. package/dist/orchestrator/tools/view-previous-screenshot.d.ts +15 -0
  45. package/dist/orchestrator/tools/view-previous-screenshot.d.ts.map +1 -0
  46. package/dist/orchestrator/tools/view-previous-screenshot.js +92 -0
  47. package/dist/orchestrator/tools/view-previous-screenshot.js.map +1 -0
  48. package/dist/orchestrator/types.d.ts +23 -1
  49. package/dist/orchestrator/types.d.ts.map +1 -1
  50. package/dist/orchestrator/types.js +11 -1
  51. package/dist/orchestrator/types.js.map +1 -1
  52. package/dist/scenario-service.d.ts +5 -0
  53. package/dist/scenario-service.d.ts.map +1 -1
  54. package/dist/scenario-service.js +17 -0
  55. package/dist/scenario-service.js.map +1 -1
  56. package/dist/scenario-worker-class.d.ts +4 -0
  57. package/dist/scenario-worker-class.d.ts.map +1 -1
  58. package/dist/scenario-worker-class.js +18 -3
  59. package/dist/scenario-worker-class.js.map +1 -1
  60. package/dist/testing/agent-tester.d.ts +35 -0
  61. package/dist/testing/agent-tester.d.ts.map +1 -0
  62. package/dist/testing/agent-tester.js +84 -0
  63. package/dist/testing/agent-tester.js.map +1 -0
  64. package/dist/testing/ref-translator-tester.d.ts +44 -0
  65. package/dist/testing/ref-translator-tester.d.ts.map +1 -0
  66. package/dist/testing/ref-translator-tester.js +104 -0
  67. package/dist/testing/ref-translator-tester.js.map +1 -0
  68. package/dist/utils/hierarchical-selector.d.ts +47 -0
  69. package/dist/utils/hierarchical-selector.d.ts.map +1 -0
  70. package/dist/utils/hierarchical-selector.js +212 -0
  71. package/dist/utils/hierarchical-selector.js.map +1 -0
  72. package/dist/utils/page-info-retry.d.ts +14 -0
  73. package/dist/utils/page-info-retry.d.ts.map +1 -0
  74. package/dist/utils/page-info-retry.js +60 -0
  75. package/dist/utils/page-info-retry.js.map +1 -0
  76. package/dist/utils/page-info-utils.d.ts +1 -0
  77. package/dist/utils/page-info-utils.d.ts.map +1 -1
  78. package/dist/utils/page-info-utils.js +46 -18
  79. package/dist/utils/page-info-utils.js.map +1 -1
  80. package/dist/utils/ref-attacher.d.ts +21 -0
  81. package/dist/utils/ref-attacher.d.ts.map +1 -0
  82. package/dist/utils/ref-attacher.js +149 -0
  83. package/dist/utils/ref-attacher.js.map +1 -0
  84. package/dist/utils/ref-translator.d.ts +49 -0
  85. package/dist/utils/ref-translator.d.ts.map +1 -0
  86. package/dist/utils/ref-translator.js +276 -0
  87. package/dist/utils/ref-translator.js.map +1 -0
  88. package/package.json +6 -1
  89. package/RELEASE_0.0.26.md +0 -165
  90. package/RELEASE_0.0.27.md +0 -236
  91. package/RELEASE_0.0.28.md +0 -286
  92. package/plandocs/BEFORE_AFTER_VERIFICATION.md +0 -148
  93. package/plandocs/COORDINATE_MODE_DIAGNOSIS.md +0 -144
  94. package/plandocs/CREDIT_CALLBACK_ARCHITECTURE.md +0 -253
  95. package/plandocs/HUMAN_LIKE_IMPROVEMENTS.md +0 -642
  96. package/plandocs/IMPLEMENTATION_STATUS.md +0 -108
  97. package/plandocs/INTEGRATION_COMPLETE.md +0 -322
  98. package/plandocs/MULTI_AGENT_ARCHITECTURE_REVIEW.md +0 -844
  99. package/plandocs/ORCHESTRATOR_MVP_SUMMARY.md +0 -539
  100. package/plandocs/PHASE1_ABSTRACTION_COMPLETE.md +0 -241
  101. package/plandocs/PHASE1_FINAL_STATUS.md +0 -210
  102. package/plandocs/PHASE_1_COMPLETE.md +0 -165
  103. package/plandocs/PHASE_1_SUMMARY.md +0 -184
  104. package/plandocs/PLANNING_SESSION_SUMMARY.md +0 -372
  105. package/plandocs/PROMPT_OPTIMIZATION_ANALYSIS.md +0 -120
  106. package/plandocs/PROMPT_SANITY_CHECK.md +0 -120
  107. package/plandocs/SCRIPT_CLEANUP_FEATURE.md +0 -201
  108. package/plandocs/SCRIPT_GENERATION_ARCHITECTURE.md +0 -364
  109. package/plandocs/SELECTOR_IMPROVEMENTS.md +0 -139
  110. package/plandocs/SESSION_SUMMARY_v0.0.33.md +0 -151
  111. package/plandocs/TROUBLESHOOTING_SESSION.md +0 -72
  112. package/plandocs/VISION_DIAGNOSTICS_IMPROVEMENTS.md +0 -336
  113. package/plandocs/VISUAL_AGENT_EVOLUTION_PLAN.md +0 -396
  114. package/plandocs/WHATS_NEW_v0.0.33.md +0 -183
  115. package/src/auth-config.ts +0 -84
  116. package/src/credit-usage-service.ts +0 -188
  117. package/src/env-loader.ts +0 -103
  118. package/src/execution-service.ts +0 -1413
  119. package/src/file-handler.ts +0 -104
  120. package/src/index.ts +0 -422
  121. package/src/llm-facade.ts +0 -821
  122. package/src/llm-provider.ts +0 -53
  123. package/src/model-constants.ts +0 -35
  124. package/src/orchestrator/index.ts +0 -34
  125. package/src/orchestrator/orchestrator-agent.ts +0 -862
  126. package/src/orchestrator/orchestrator-agent.ts.backup +0 -1386
  127. package/src/orchestrator/orchestrator-prompts.ts +0 -474
  128. package/src/orchestrator/tool-registry.ts +0 -182
  129. package/src/orchestrator/tools/check-page-ready.ts +0 -75
  130. package/src/orchestrator/tools/extract-data.ts +0 -92
  131. package/src/orchestrator/tools/index.ts +0 -12
  132. package/src/orchestrator/tools/inspect-page.ts +0 -42
  133. package/src/orchestrator/tools/recall-history.ts +0 -72
  134. package/src/orchestrator/tools/take-screenshot.ts +0 -128
  135. package/src/orchestrator/tools/verify-action-result.ts +0 -159
  136. package/src/orchestrator/types.ts +0 -248
  137. package/src/playwright-mcp-service.ts +0 -224
  138. package/src/progress-reporter.ts +0 -144
  139. package/src/prompts.ts +0 -842
  140. package/src/providers/backend-proxy-llm-provider.ts +0 -91
  141. package/src/providers/local-llm-provider.ts +0 -38
  142. package/src/scenario-service.ts +0 -232
  143. package/src/scenario-worker-class.ts +0 -1089
  144. package/src/script-utils.ts +0 -203
  145. package/src/types.ts +0 -239
  146. package/src/utils/browser-utils.ts +0 -348
  147. package/src/utils/coordinate-converter.ts +0 -162
  148. package/src/utils/page-info-utils.ts +0 -250
  149. package/testchimp-runner-core-0.0.33.tgz +0 -0
  150. package/tsconfig.json +0 -19
@@ -1,250 +0,0 @@
1
- /**
2
- * Enhanced Page Info Utilities
3
- * Extracts ARIA tree, interactive elements with bounding boxes, and suggested selectors
4
- */
5
-
6
- export interface InteractiveElement {
7
- tag: string;
8
- id: string | null;
9
- text: string;
10
- type: string;
11
- role: string;
12
- ariaLabel: string;
13
- placeholder: string;
14
- bbox: {x: number; y: number; width: number; height: number};
15
- selectors: string[];
16
- }
17
-
18
- export interface PageInfo {
19
- url: string;
20
- title: string;
21
- ariaSnapshot: any; // Raw ARIA tree for hierarchical structure
22
- interactiveElements: InteractiveElement[]; // All interactive elements with position and selectors
23
- formattedElements: string; // Human-readable summary for logging
24
- }
25
-
26
- export async function getEnhancedPageInfo(page: any): Promise<PageInfo>;
27
- export async function getEnhancedPageInfo(domSnapshot: { url: string; title: string; accessibilityTree: any }): Promise<PageInfo>;
28
- export async function getEnhancedPageInfo(input: any | { url: string; title: string; accessibilityTree: any }): Promise<PageInfo> {
29
- let domSnapshot: { url: string; title: string; accessibilityTree: any } = { url: 'Unknown', title: 'Unknown', accessibilityTree: null };
30
- let interactiveElements: InteractiveElement[] = [];
31
- let hasPageObject = false;
32
-
33
- try {
34
- if ('accessibility' in input) {
35
- // Input is a Page object
36
- hasPageObject = true;
37
- const snapshot = await input.accessibility.snapshot();
38
- const url = input.url();
39
- const title = await input.title();
40
- domSnapshot = { url, title, accessibilityTree: snapshot };
41
-
42
- // Extract ALL interactive elements with bounding boxes and selectors
43
- try {
44
- interactiveElements = await input.evaluate(() => {
45
- const doc = (globalThis as any).document;
46
- const elements: any[] = [];
47
-
48
- // Get all interactive elements
49
- const interactiveSelectors = [
50
- 'button',
51
- 'input',
52
- 'textarea',
53
- 'select',
54
- 'a[href]',
55
- '[role="button"]',
56
- '[role="link"]',
57
- '[role="textbox"]',
58
- '[role="checkbox"]',
59
- '[role="radio"]',
60
- '[onclick]'
61
- ];
62
-
63
- const allInteractive = new Set<any>();
64
- interactiveSelectors.forEach((selector: string) => {
65
- doc.querySelectorAll(selector).forEach((el: any) => allInteractive.add(el));
66
- });
67
-
68
- allInteractive.forEach((el: any) => {
69
- const rect = el.getBoundingClientRect();
70
-
71
- // Skip invisible elements
72
- if (rect.width === 0 || rect.height === 0) return;
73
-
74
- const id = el.id || null;
75
- const tag = el.tagName.toLowerCase();
76
- const text = el.textContent?.trim().substring(0, 40) || '';
77
- const type = el.type || '';
78
- const role = el.getAttribute('role') || el.tagName.toLowerCase();
79
- const ariaLabel = el.getAttribute('aria-label') || '';
80
- const placeholder = el.placeholder || '';
81
-
82
- // Build possible selectors - PRIORITIZE SEMANTIC SELECTORS (Playwright best practices)
83
- const selectors: string[] = [];
84
-
85
- // 1. BEST: getByLabel for form inputs with associated labels
86
- if ((tag === 'input' || tag === 'textarea' || tag === 'select') && el.labels && el.labels.length > 0) {
87
- const labelText = el.labels[0].textContent?.trim();
88
- if (labelText && labelText.length > 0 && labelText.length < 50) {
89
- selectors.push(`getByLabel('${labelText}')`);
90
- }
91
- }
92
-
93
- // 2. BEST: getByRole with name (semantic and accessible)
94
- if (text && text.length > 0 && text.length < 30) {
95
- selectors.push(`getByRole('${role}', {name: '${text}'})`);
96
- }
97
-
98
- // 3. BEST: getByPlaceholder for inputs with placeholders
99
- if (placeholder && placeholder.length > 0 && placeholder.length < 50) {
100
- selectors.push(`getByPlaceholder('${placeholder}')`);
101
- }
102
-
103
- // 4. GOOD: getByText for elements with visible text (fallback for non-role elements)
104
- if (text && text.length > 0 && text.length < 30 && !selectors.some(s => s.includes('getByRole'))) {
105
- selectors.push(`getByText('${text}')`);
106
- }
107
-
108
- // 5. GOOD: data-testid attributes (stable, explicit)
109
- const dataTestId = el.getAttribute('data-testid') || el.getAttribute('data-test-id') ||
110
- el.getAttribute('data-id') || el.getAttribute('data-test');
111
- if (dataTestId) selectors.push(`getByTestId('${dataTestId}')`);
112
-
113
- // 6. LAST RESORT: ID selector (only if stable - avoid auto-generated IDs with unicode)
114
- // Skip auto-generated Ant Design IDs like «r3»-form-item or rc_select_xxx
115
- if (id && !id.includes('«') && !id.match(/^(rc_|:r[0-9]+:|__)/)) {
116
- selectors.push(`#${id}`);
117
- }
118
-
119
- elements.push({
120
- tag,
121
- id,
122
- text,
123
- type,
124
- role,
125
- ariaLabel,
126
- placeholder,
127
- bbox: {
128
- x: Math.round(rect.x),
129
- y: Math.round(rect.y),
130
- width: Math.round(rect.width),
131
- height: Math.round(rect.height)
132
- },
133
- selectors
134
- });
135
- });
136
-
137
- return elements;
138
- });
139
- } catch (evalError: any) {
140
- // Error extracting interactive elements - continue with empty array
141
- console.error('[getEnhancedPageInfo] Failed to extract interactive elements:', evalError.message);
142
- interactiveElements = [];
143
- }
144
- } else {
145
- // Input is already a domSnapshot
146
- domSnapshot = input;
147
- }
148
-
149
- // Log extraction results for debugging
150
- if (hasPageObject) {
151
- console.log(`[getEnhancedPageInfo] Extracted ${interactiveElements.length} interactive elements from ${domSnapshot.url}`);
152
- }
153
-
154
- // Create smart summary prioritizing important elements over repetitive lists
155
- let formattedElements = '';
156
-
157
- if (interactiveElements.length > 0) {
158
- // Prioritize: forms/buttons > unique elements > list items
159
- const prioritized: InteractiveElement[] = [];
160
- const listItems: InteractiveElement[] = [];
161
-
162
- // Group elements
163
- for (const el of interactiveElements) {
164
- // High priority: forms, buttons, unique interactive elements
165
- if (['input', 'textarea', 'select', 'button'].includes(el.tag) ||
166
- (el.tag === 'a' && el.text.length > 0 && el.text.length < 50)) {
167
- prioritized.push(el);
168
- } else {
169
- listItems.push(el);
170
- }
171
- }
172
-
173
- // Take top 25 prioritized
174
- const selectedElements = prioritized.slice(0, 25);
175
-
176
- // Add sample of list items if space remains (show diversity, not just first N)
177
- if (selectedElements.length < 30 && listItems.length > 0) {
178
- const step = Math.max(1, Math.floor(listItems.length / 5)); // Sample 5 from list
179
- for (let i = 0; i < Math.min(5, listItems.length); i++) {
180
- selectedElements.push(listItems[i * step]);
181
- }
182
- }
183
-
184
- formattedElements = selectedElements.map((e, i) => {
185
- const idInfo = e.id ? `#${e.id}` : 'NO-ID';
186
- const typeInfo = e.type ? ` type="${e.type}"` : '';
187
- const placeholderInfo = e.placeholder ? ` placeholder="${e.placeholder}"` : '';
188
-
189
- // Show BEST selector first, with alternatives
190
- let selectorsInfo: string;
191
- if (e.selectors && e.selectors.length > 0) {
192
- selectorsInfo = e.selectors[0]; // Best option
193
- if (e.selectors.length > 1) {
194
- selectorsInfo += ` (or: ${e.selectors.slice(1, 3).join(', ')})`; // Show up to 2 alternatives
195
- }
196
- } else {
197
- selectorsInfo = 'No reliable selector available';
198
- }
199
-
200
- return `${i + 1}. [${e.bbox.x},${e.bbox.y} ${e.bbox.width}x${e.bbox.height}] <${e.tag}> ${idInfo}${typeInfo}${placeholderInfo} "${e.text}"
201
- → ${selectorsInfo}`;
202
- }).join('\n');
203
-
204
- // Show stats for omitted elements
205
- const omitted = interactiveElements.length - selectedElements.length;
206
- if (omitted > 0) {
207
- formattedElements += `\n\n... (+${omitted} more elements)`;
208
-
209
- // Show pattern summary for lists/tables
210
- const linkCount = interactiveElements.filter(e => e.tag === 'a').length;
211
- const listItemPatterns: Record<string, number> = {};
212
-
213
- for (const el of interactiveElements) {
214
- if (el.tag === 'a' || el.tag === 'li' || el.tag === 'div') {
215
- const pattern = `${el.tag}${el.role ? `[${el.role}]` : ''}`;
216
- listItemPatterns[pattern] = (listItemPatterns[pattern] || 0) + 1;
217
- }
218
- }
219
-
220
- if (Object.keys(listItemPatterns).length > 0) {
221
- formattedElements += `\nPattern summary: `;
222
- formattedElements += Object.entries(listItemPatterns)
223
- .filter(([_, count]) => count > 5)
224
- .map(([pattern, count]) => `${count}x ${pattern}`)
225
- .join(', ');
226
- }
227
- }
228
- } else {
229
- formattedElements = 'No interactive elements found (page may not be loaded or extraction failed)';
230
- }
231
-
232
- return {
233
- url: domSnapshot.url,
234
- title: domSnapshot.title,
235
- ariaSnapshot: domSnapshot.accessibilityTree,
236
- interactiveElements,
237
- formattedElements
238
- };
239
- } catch (error: any) {
240
- // Error extracting page info - return defaults
241
- console.error('[getEnhancedPageInfo] Top-level error:', error.message);
242
- return {
243
- url: domSnapshot?.url || 'Unknown',
244
- title: 'Unknown',
245
- ariaSnapshot: null,
246
- interactiveElements: [],
247
- formattedElements: `Unable to extract: ${error.message}`
248
- };
249
- }
250
- }
Binary file
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "lib": ["ES2020"],
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true,
15
- "resolveJsonModule": true
16
- },
17
- "include": ["src/**/*"],
18
- "exclude": ["node_modules", "dist", "**/*.test.ts"]
19
- }