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
@@ -0,0 +1,227 @@
1
+ # Journey ID Tracking for Prompt-Based Explorations
2
+
3
+ ## Journey Identification Strategy
4
+
5
+ ### Test-Based Journeys
6
+ - **Journey ID**: Test ID (from the test being executed)
7
+ - **Journey Name**: Test name (from test metadata)
8
+ - Journeys already exist in the database
9
+
10
+ ### Prompt-Based Journeys
11
+ - **Journey ID**: UUID generated by AppExplorer when creating the journey
12
+ - **Journey Name**: Derived from the journey focus prompt
13
+ - Journeys must be created and stored before execution
14
+
15
+ ---
16
+
17
+ ## Implementation Changes to AppExplorer
18
+
19
+ ### Add Journey Creation Methods
20
+
21
+ **File**: `scriptservice/workers/app-explorer.ts`
22
+
23
+ Add helper methods for creating prompt-based journeys:
24
+
25
+ ```typescript
26
+ /**
27
+ * Generate a descriptive journey name from the focus prompt
28
+ */
29
+ private generateJourneyName(journeyFocusPrompt: string): string {
30
+ // Convert prompt to concise journey name
31
+ // Examples:
32
+ // "Explore Dashboard and test all widgets" → "Dashboard Widgets Exploration"
33
+ // "Navigate to Settings and test user profile" → "Settings User Profile Test"
34
+
35
+ // Simple implementation: truncate and clean
36
+ let name = journeyFocusPrompt
37
+ .replace(/^(Explore|Test|Navigate to|Check|Verify)\s+/i, '') // Remove action verbs
38
+ .substring(0, 80) // Limit length
39
+ .trim();
40
+
41
+ // Capitalize first letter
42
+ name = name.charAt(0).toUpperCase() + name.slice(1);
43
+
44
+ return name;
45
+ }
46
+
47
+ /**
48
+ * Create and store a prompt-based journey in database
49
+ * Uses scriptservice's own journey service (ORM/repository layer)
50
+ */
51
+ private async createPromptBasedJourney(
52
+ journeyId: string,
53
+ journeyName: string,
54
+ journeyFocusPrompt: string
55
+ ): Promise<void> {
56
+ try {
57
+ // Use scriptservice's journey service (ORM/repository)
58
+ // Import: import { saveJourney } from '../services/journey-service';
59
+ // (or whatever the actual journey service method is called in scriptservice)
60
+
61
+ await saveJourney({
62
+ id: journeyId,
63
+ name: journeyName,
64
+ description: journeyFocusPrompt, // Store the full prompt as description
65
+ projectId: this.task.projectId,
66
+ type: 'PROMPT_BASED_EXPLORATION', // Type already exists in schema
67
+ explorationId: this.explorationId, // Link to parent exploration
68
+ createdAt: new Date()
69
+ });
70
+
71
+ logger.info(`Created prompt-based journey: ${journeyId} - ${journeyName}`);
72
+ } catch (error) {
73
+ logger.error(`Failed to create journey ${journeyId}: ${error}`);
74
+ throw error;
75
+ }
76
+ }
77
+ ```
78
+
79
+ ### Update runSinglePromptBasedJourney
80
+
81
+ ```typescript
82
+ /**
83
+ * Execute a single prompt-based journey with given focus
84
+ */
85
+ private async runSinglePromptBasedJourney(
86
+ journeyFocusPrompt: string,
87
+ testDataPrompt?: string
88
+ ): Promise<void> {
89
+ // Generate journey ID and name for prompt-based journey
90
+ const journeyId = uuidv4(); // NEW: Generate UUID for this journey
91
+ const journeyName = this.generateJourneyName(journeyFocusPrompt); // NEW: Derive name from prompt
92
+
93
+ logger.info(`Creating prompt-based journey: ${journeyId} - ${journeyName}`);
94
+
95
+ // Create and store journey in database via journey service
96
+ await this.createPromptBasedJourney(journeyId, journeyName, journeyFocusPrompt);
97
+
98
+ // Create journey task
99
+ const task: JourneyTask = {
100
+ invocationId: uuidv4(),
101
+ invocationBatchId: this.explorationId,
102
+ projectId: this.task.projectId,
103
+ appReleaseId: this.config.webappReleaseVersion ?? "default",
104
+ autohealEnabled: false,
105
+ sessionRecordApiKey: this.task.sessionRecordApiKey,
106
+ ingressEndpoint: await ConfigService.get('test_service_endpoint'),
107
+ enableTestchimpSdkOnExec: false,
108
+ urlRegexToCapture: ".*",
109
+ playwrightConfig: this.config.playwrightConfig,
110
+ creditBudget: this.getCreditsForNextJourney(),
111
+ bugCaptureSettings: this.config.bugCaptureSettings,
112
+ viewportConfig: this.config.viewportConfig,
113
+
114
+ // NEW: Journey identification for prompt-based
115
+ testId: journeyId, // Use generated journey ID (as testId for compatibility)
116
+ testName: { // Use generated journey name
117
+ suite: 'Prompt-Based Exploration',
118
+ name: journeyName
119
+ },
120
+
121
+ // Enable journey exploration mode with focused prompt
122
+ journeyExplorationMode: {
123
+ enabled: true,
124
+ journeyFocusPrompt, // Journey-specific focus
125
+ testDataPrompt
126
+ }
127
+ };
128
+
129
+ // Use JourneyRunner (handles both test-based and prompt-based)
130
+ const runner = new JourneyRunner(
131
+ task,
132
+ this.onBugsDiscovered.bind(this),
133
+ this.onScreenStateVisited.bind(this),
134
+ // ... all other callbacks
135
+ );
136
+
137
+ await runner.run();
138
+ }
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Database Schema (No Changes Needed)
144
+
145
+ ### Journey Entity
146
+
147
+ The journey table **already supports** both test-based and prompt-based journeys (from agentservice implementation). We're simply reusing the existing structure:
148
+
149
+ ```typescript
150
+ interface Journey {
151
+ id: string; // UUID (test ID for test-based, generated for prompt-based)
152
+ name: string; // Human-readable name
153
+ description?: string; // Full prompt for prompt-based, test description for test-based
154
+ projectId: string;
155
+ type: 'TEST_BASED' | 'PROMPT_BASED_EXPLORATION'; // Already exists
156
+ createdAt: Date;
157
+ explorationId?: string; // Link to parent exploration
158
+ // ... other existing fields
159
+ }
160
+ ```
161
+
162
+ **No schema changes required** - we'll use existing journey service (ORM/repository) that scriptservice already has.
163
+
164
+ ---
165
+
166
+ ## Flow Comparison
167
+
168
+ ### Test-Based Journey Flow
169
+
170
+ ```
171
+ AppExplorer (test-based)
172
+
173
+ Select test from test tree
174
+
175
+ Create JourneyTask with:
176
+ - testId: <existing test ID>
177
+ - testName: <existing test name>
178
+ - journeyExplorationMode: disabled
179
+
180
+ JourneyRunner executes test steps
181
+ ```
182
+
183
+ ### Prompt-Based Journey Flow
184
+
185
+ ```
186
+ AppExplorer (prompt-based)
187
+
188
+ LLM generates journey focus prompt
189
+
190
+ Generate journeyId (UUID)
191
+ Generate journeyName from prompt
192
+
193
+ Create & store journey via journey service (ORM)
194
+
195
+ Create JourneyTask with:
196
+ - testId: <generated journey ID>
197
+ - testName: <generated journey name>
198
+ - journeyExplorationMode: enabled
199
+ - journeyFocusPrompt: <specific focus>
200
+
201
+ JourneyRunner executes autonomously via orchestrator
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Benefits of This Approach
207
+
208
+ 1. **Unified Tracking**: Both test-based and prompt-based journeys use the same journey table and reporting infrastructure
209
+ 2. **Traceability**: Each prompt-based journey has a unique ID for bug tracking, screen state linking, execution history
210
+ 3. **Naming Consistency**: Generated journey names are descriptive and help understand exploration progress
211
+ 4. **No Schema Changes**: Reuses existing journey infrastructure - same table, same ORM service
212
+ 5. **No Cross-Service Imports**: Uses scriptservice's own journey service (ORM layer) - no dependencies on agentservice (Python)
213
+ 6. **Consolidation**: Moves prompt-based exploration from agentservice to scriptservice using runner-core orchestrator
214
+ 7. **Code Deduplication**: Removes browser-use dependency, uses same orchestrator for both test-based and prompt-based modes
215
+
216
+ ---
217
+
218
+ ## Example Journey Names Generated
219
+
220
+ | Journey Focus Prompt | Generated Journey Name |
221
+ |---------------------|----------------------|
222
+ | "Explore Dashboard and test all widgets" | "Dashboard and test all widgets" |
223
+ | "Navigate to Settings and test user profile management" | "Settings and test user profile management" |
224
+ | "Test all menu options in the navigation bar" | "all menu options in the navigation bar" |
225
+ | "Explore admin panel features and permissions" | "admin panel features and permissions" |
226
+
227
+ (The `generateJourneyName` method can be enhanced with better NLP to create more concise names)