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.
Files changed (152) 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/llm-facade.d.ts.map +1 -1
  10. package/dist/llm-facade.js +7 -7
  11. package/dist/llm-facade.js.map +1 -1
  12. package/dist/llm-provider.d.ts +9 -0
  13. package/dist/llm-provider.d.ts.map +1 -1
  14. package/dist/model-constants.d.ts +16 -5
  15. package/dist/model-constants.d.ts.map +1 -1
  16. package/dist/model-constants.js +17 -6
  17. package/dist/model-constants.js.map +1 -1
  18. package/dist/orchestrator/decision-parser.d.ts +18 -0
  19. package/dist/orchestrator/decision-parser.d.ts.map +1 -0
  20. package/dist/orchestrator/decision-parser.js +127 -0
  21. package/dist/orchestrator/decision-parser.js.map +1 -0
  22. package/dist/orchestrator/index.d.ts +4 -2
  23. package/dist/orchestrator/index.d.ts.map +1 -1
  24. package/dist/orchestrator/index.js +15 -2
  25. package/dist/orchestrator/index.js.map +1 -1
  26. package/dist/orchestrator/orchestrator-agent.d.ts +17 -22
  27. package/dist/orchestrator/orchestrator-agent.d.ts.map +1 -1
  28. package/dist/orchestrator/orchestrator-agent.js +708 -577
  29. package/dist/orchestrator/orchestrator-agent.js.map +1 -1
  30. package/dist/orchestrator/orchestrator-prompts.d.ts +32 -0
  31. package/dist/orchestrator/orchestrator-prompts.d.ts.map +1 -0
  32. package/dist/orchestrator/orchestrator-prompts.js +737 -0
  33. package/dist/orchestrator/orchestrator-prompts.js.map +1 -0
  34. package/dist/orchestrator/page-som-handler.d.ts +106 -0
  35. package/dist/orchestrator/page-som-handler.d.ts.map +1 -0
  36. package/dist/orchestrator/page-som-handler.js +1353 -0
  37. package/dist/orchestrator/page-som-handler.js.map +1 -0
  38. package/dist/orchestrator/som-types.d.ts +149 -0
  39. package/dist/orchestrator/som-types.d.ts.map +1 -0
  40. package/dist/orchestrator/som-types.js +87 -0
  41. package/dist/orchestrator/som-types.js.map +1 -0
  42. package/dist/orchestrator/tool-registry.d.ts +2 -0
  43. package/dist/orchestrator/tool-registry.d.ts.map +1 -1
  44. package/dist/orchestrator/tool-registry.js.map +1 -1
  45. package/dist/orchestrator/tools/index.d.ts +5 -1
  46. package/dist/orchestrator/tools/index.d.ts.map +1 -1
  47. package/dist/orchestrator/tools/index.js +9 -2
  48. package/dist/orchestrator/tools/index.js.map +1 -1
  49. package/dist/orchestrator/tools/refresh-som-markers.d.ts +12 -0
  50. package/dist/orchestrator/tools/refresh-som-markers.d.ts.map +1 -0
  51. package/dist/orchestrator/tools/refresh-som-markers.js +64 -0
  52. package/dist/orchestrator/tools/refresh-som-markers.js.map +1 -0
  53. package/dist/orchestrator/tools/verify-action-result.d.ts +17 -0
  54. package/dist/orchestrator/tools/verify-action-result.d.ts.map +1 -0
  55. package/dist/orchestrator/tools/verify-action-result.js +140 -0
  56. package/dist/orchestrator/tools/verify-action-result.js.map +1 -0
  57. package/dist/orchestrator/tools/view-previous-screenshot.d.ts +15 -0
  58. package/dist/orchestrator/tools/view-previous-screenshot.d.ts.map +1 -0
  59. package/dist/orchestrator/tools/view-previous-screenshot.js +92 -0
  60. package/dist/orchestrator/tools/view-previous-screenshot.js.map +1 -0
  61. package/dist/orchestrator/types.d.ts +49 -1
  62. package/dist/orchestrator/types.d.ts.map +1 -1
  63. package/dist/orchestrator/types.js +11 -1
  64. package/dist/orchestrator/types.js.map +1 -1
  65. package/dist/prompts.d.ts.map +1 -1
  66. package/dist/prompts.js +40 -34
  67. package/dist/prompts.js.map +1 -1
  68. package/dist/scenario-service.d.ts +5 -0
  69. package/dist/scenario-service.d.ts.map +1 -1
  70. package/dist/scenario-service.js +17 -0
  71. package/dist/scenario-service.js.map +1 -1
  72. package/dist/scenario-worker-class.d.ts +4 -0
  73. package/dist/scenario-worker-class.d.ts.map +1 -1
  74. package/dist/scenario-worker-class.js +21 -3
  75. package/dist/scenario-worker-class.js.map +1 -1
  76. package/dist/testing/agent-tester.d.ts +35 -0
  77. package/dist/testing/agent-tester.d.ts.map +1 -0
  78. package/dist/testing/agent-tester.js +84 -0
  79. package/dist/testing/agent-tester.js.map +1 -0
  80. package/dist/testing/ref-translator-tester.d.ts +44 -0
  81. package/dist/testing/ref-translator-tester.d.ts.map +1 -0
  82. package/dist/testing/ref-translator-tester.js +104 -0
  83. package/dist/testing/ref-translator-tester.js.map +1 -0
  84. package/dist/utils/coordinate-converter.d.ts +32 -0
  85. package/dist/utils/coordinate-converter.d.ts.map +1 -0
  86. package/dist/utils/coordinate-converter.js +130 -0
  87. package/dist/utils/coordinate-converter.js.map +1 -0
  88. package/dist/utils/hierarchical-selector.d.ts +47 -0
  89. package/dist/utils/hierarchical-selector.d.ts.map +1 -0
  90. package/dist/utils/hierarchical-selector.js +212 -0
  91. package/dist/utils/hierarchical-selector.js.map +1 -0
  92. package/dist/utils/page-info-retry.d.ts +14 -0
  93. package/dist/utils/page-info-retry.d.ts.map +1 -0
  94. package/dist/utils/page-info-retry.js +60 -0
  95. package/dist/utils/page-info-retry.js.map +1 -0
  96. package/dist/utils/page-info-utils.d.ts +1 -0
  97. package/dist/utils/page-info-utils.d.ts.map +1 -1
  98. package/dist/utils/page-info-utils.js +46 -18
  99. package/dist/utils/page-info-utils.js.map +1 -1
  100. package/dist/utils/ref-attacher.d.ts +21 -0
  101. package/dist/utils/ref-attacher.d.ts.map +1 -0
  102. package/dist/utils/ref-attacher.js +149 -0
  103. package/dist/utils/ref-attacher.js.map +1 -0
  104. package/dist/utils/ref-translator.d.ts +49 -0
  105. package/dist/utils/ref-translator.d.ts.map +1 -0
  106. package/dist/utils/ref-translator.js +276 -0
  107. package/dist/utils/ref-translator.js.map +1 -0
  108. package/package.json +1 -1
  109. package/plandocs/BEFORE_AFTER_VERIFICATION.md +148 -0
  110. package/plandocs/COORDINATE_MODE_DIAGNOSIS.md +144 -0
  111. package/plandocs/IMPLEMENTATION_STATUS.md +108 -0
  112. package/plandocs/PHASE_1_COMPLETE.md +165 -0
  113. package/plandocs/PHASE_1_SUMMARY.md +184 -0
  114. package/plandocs/PROMPT_OPTIMIZATION_ANALYSIS.md +120 -0
  115. package/plandocs/PROMPT_SANITY_CHECK.md +120 -0
  116. package/plandocs/SESSION_SUMMARY_v0.0.33.md +151 -0
  117. package/plandocs/TROUBLESHOOTING_SESSION.md +72 -0
  118. package/plandocs/VISUAL_AGENT_EVOLUTION_PLAN.md +396 -0
  119. package/plandocs/WHATS_NEW_v0.0.33.md +183 -0
  120. package/plandocs/exploratory-mode-support-v2.plan.md +953 -0
  121. package/plandocs/exploratory-mode-support.plan.md +928 -0
  122. package/plandocs/journey-id-tracking-addendum.md +227 -0
  123. package/src/execution-service.ts +179 -596
  124. package/src/index.ts +10 -0
  125. package/src/llm-facade.ts +8 -8
  126. package/src/llm-provider.ts +11 -1
  127. package/src/model-constants.ts +17 -5
  128. package/src/orchestrator/decision-parser.ts +139 -0
  129. package/src/orchestrator/index.ts +27 -2
  130. package/src/orchestrator/orchestrator-agent.ts +868 -623
  131. package/src/orchestrator/orchestrator-prompts.ts +786 -0
  132. package/src/orchestrator/page-som-handler.ts +1565 -0
  133. package/src/orchestrator/som-types.ts +188 -0
  134. package/src/orchestrator/tool-registry.ts +2 -0
  135. package/src/orchestrator/tools/index.ts +5 -1
  136. package/src/orchestrator/tools/refresh-som-markers.ts +69 -0
  137. package/src/orchestrator/tools/verify-action-result.ts +159 -0
  138. package/src/orchestrator/tools/view-previous-screenshot.ts +103 -0
  139. package/src/orchestrator/types.ts +95 -4
  140. package/src/prompts.ts +40 -34
  141. package/src/scenario-service.ts +20 -0
  142. package/src/scenario-worker-class.ts +30 -4
  143. package/src/utils/coordinate-converter.ts +162 -0
  144. package/src/utils/page-info-retry.ts +65 -0
  145. package/src/utils/page-info-utils.ts +53 -18
  146. package/testchimp-runner-core-0.0.35.tgz +0 -0
  147. /package/{CREDIT_CALLBACK_ARCHITECTURE.md → plandocs/CREDIT_CALLBACK_ARCHITECTURE.md} +0 -0
  148. /package/{INTEGRATION_COMPLETE.md → plandocs/INTEGRATION_COMPLETE.md} +0 -0
  149. /package/{VISION_DIAGNOSTICS_IMPROVEMENTS.md → plandocs/VISION_DIAGNOSTICS_IMPROVEMENTS.md} +0 -0
  150. /package/{RELEASE_0.0.26.md → releasenotes/RELEASE_0.0.26.md} +0 -0
  151. /package/{RELEASE_0.0.27.md → releasenotes/RELEASE_0.0.27.md} +0 -0
  152. /package/{RELEASE_0.0.28.md → releasenotes/RELEASE_0.0.28.md} +0 -0
@@ -8,6 +8,7 @@ export interface InteractiveElement {
8
8
  id: string | null;
9
9
  text: string;
10
10
  type: string;
11
+ name: string; // name attribute (critical for form inputs)
11
12
  role: string;
12
13
  ariaLabel: string;
13
14
  placeholder: string;
@@ -34,7 +35,9 @@ export async function getEnhancedPageInfo(input: any | { url: string; title: str
34
35
  if ('accessibility' in input) {
35
36
  // Input is a Page object
36
37
  hasPageObject = true;
37
- const snapshot = await input.accessibility.snapshot();
38
+ // CRITICAL: Use interestingOnly: false to get FULL ARIA tree like Playwright MCP
39
+ // This includes all structural nodes (generic, paragraph, etc.) not just interactive ones
40
+ const snapshot = await input.accessibility.snapshot({ interestingOnly: false });
38
41
  const url = input.url();
39
42
  const title = await input.title();
40
43
  domSnapshot = { url, title, accessibilityTree: snapshot };
@@ -57,7 +60,8 @@ export async function getEnhancedPageInfo(input: any | { url: string; title: str
57
60
  '[role="textbox"]',
58
61
  '[role="checkbox"]',
59
62
  '[role="radio"]',
60
- '[onclick]'
63
+ '[onclick]',
64
+ '[type="submit"]'
61
65
  ];
62
66
 
63
67
  const allInteractive = new Set<any>();
@@ -65,11 +69,30 @@ export async function getEnhancedPageInfo(input: any | { url: string; title: str
65
69
  doc.querySelectorAll(selector).forEach((el: any) => allInteractive.add(el));
66
70
  });
67
71
 
72
+ // CRITICAL: Also detect elements that are styled/behave as interactive
73
+ // (e.g., divs/spans with cursor:pointer, click handlers)
74
+ // This catches modern web apps that use non-semantic HTML
75
+ const allElements = doc.querySelectorAll('div, span, p, li, td');
76
+ allElements.forEach((el: any) => {
77
+ const styles = (globalThis as any).window.getComputedStyle(el);
78
+ const hasClickHandler = el.onclick ||
79
+ el.getAttribute('onclick') ||
80
+ el.hasAttribute('data-action') ||
81
+ el.hasAttribute('data-click');
82
+
83
+ // Include if: cursor is pointer, has click handler, or has tabindex (keyboard focusable)
84
+ if (styles.cursor === 'pointer' || hasClickHandler || el.tabIndex >= 0) {
85
+ allInteractive.add(el);
86
+ }
87
+ });
88
+
68
89
  allInteractive.forEach((el: any) => {
69
90
  const rect = el.getBoundingClientRect();
70
91
 
71
92
  // Skip invisible elements
72
- if (rect.width === 0 || rect.height === 0) return;
93
+ if (rect.width === 0 || rect.height === 0) {
94
+ return;
95
+ }
73
96
 
74
97
  const id = el.id || null;
75
98
  const tag = el.tagName.toLowerCase();
@@ -95,6 +118,12 @@ export async function getEnhancedPageInfo(input: any | { url: string; title: str
95
118
  selectors.push(`getByRole('${role}', {name: '${text}'})`);
96
119
  }
97
120
 
121
+ // 2b. BEST: getByRole for buttons with type attribute (more specific)
122
+ if (tag === 'button' && el.type) {
123
+ selectors.push(`getByRole('button', {name: '${text}'})`);
124
+ selectors.push(`button[type="${el.type}"]`);
125
+ }
126
+
98
127
  // 3. BEST: getByPlaceholder for inputs with placeholders
99
128
  if (placeholder && placeholder.length > 0 && placeholder.length < 50) {
100
129
  selectors.push(`getByPlaceholder('${placeholder}')`);
@@ -110,7 +139,21 @@ export async function getEnhancedPageInfo(input: any | { url: string; title: str
110
139
  el.getAttribute('data-id') || el.getAttribute('data-test');
111
140
  if (dataTestId) selectors.push(`getByTestId('${dataTestId}')`);
112
141
 
113
- // 6. LAST RESORT: ID selector (only if stable - avoid auto-generated IDs with unicode)
142
+ // 6. GOOD: name attribute (especially for form inputs - very common and stable)
143
+ const nameAttr = el.getAttribute('name');
144
+ if (nameAttr && (tag === 'input' || tag === 'textarea' || tag === 'select')) {
145
+ selectors.push(`input[name="${nameAttr}"]`);
146
+ }
147
+
148
+ // 6b. GOOD: class-based selectors for buttons (common in modern frameworks)
149
+ if (tag === 'button' && el.className) {
150
+ const classes = el.className.split(' ').filter((c: string) => c.length > 0 && !c.includes('userfront-'));
151
+ if (classes.length > 0) {
152
+ selectors.push(`button.${classes[0]}`);
153
+ }
154
+ }
155
+
156
+ // 7. LAST RESORT: ID selector (only if stable - avoid auto-generated IDs with unicode)
114
157
  // Skip auto-generated Ant Design IDs like «r3»-form-item or rc_select_xxx
115
158
  if (id && !id.includes('«') && !id.match(/^(rc_|:r[0-9]+:|__)/)) {
116
159
  selectors.push(`#${id}`);
@@ -121,6 +164,7 @@ export async function getEnhancedPageInfo(input: any | { url: string; title: str
121
164
  id,
122
165
  text,
123
166
  type,
167
+ name: nameAttr || '', // CRITICAL: Capture name attribute for form inputs
124
168
  role,
125
169
  ariaLabel,
126
170
  placeholder,
@@ -182,23 +226,14 @@ export async function getEnhancedPageInfo(input: any | { url: string; title: str
182
226
  }
183
227
 
184
228
  formattedElements = selectedElements.map((e, i) => {
185
- const idInfo = e.id ? `#${e.id}` : 'NO-ID';
229
+ const idInfo = e.id ? `#${e.id}` : '';
186
230
  const typeInfo = e.type ? ` type="${e.type}"` : '';
231
+ const nameInfo = e.name ? ` name="${e.name}"` : '';
187
232
  const placeholderInfo = e.placeholder ? ` placeholder="${e.placeholder}"` : '';
233
+ const roleInfo = e.role ? ` role="${e.role}"` : '';
188
234
 
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}`;
235
+ // Compact format: show all relevant attributes for LLM to construct selectors
236
+ return `${i + 1}. [${e.bbox.x},${e.bbox.y} ${e.bbox.width}x${e.bbox.height}] <${e.tag}>${idInfo}${typeInfo}${nameInfo}${placeholderInfo}${roleInfo} "${e.text}"`;
202
237
  }).join('\n');
203
238
 
204
239
  // Show stats for omitted elements
Binary file