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
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+ /**
3
+ * Ref Translation Utility
4
+ * Converts structured ref commands to Playwright commands with fallback alternatives
5
+ * Uses hierarchical ARIA tree context for robust selector generation
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.RefTranslator = void 0;
9
+ const hierarchical_selector_1 = require("./hierarchical-selector");
10
+ class RefTranslator {
11
+ constructor(logger) {
12
+ this.logger = logger;
13
+ this.hierarchicalGenerator = new hierarchical_selector_1.HierarchicalSelectorGenerator(logger);
14
+ }
15
+ /**
16
+ * LEGACY: Translate string commands (supports regex getByRef pattern)
17
+ * Use translateRefCommands() instead for new code
18
+ */
19
+ async translateStringCommands(commands, page, refMap, ariaTree) {
20
+ const translated = [];
21
+ for (const cmd of commands) {
22
+ // Check if command contains getByRef (legacy regex pattern)
23
+ const refMatch = cmd.match(/getByRef\s*\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]*)['"]\s*)?\)/);
24
+ if (refMatch && refMap && ariaTree) {
25
+ const [, ref, operation, value] = refMatch;
26
+ // Use structured approach internally
27
+ const refCmd = {
28
+ type: 'ref',
29
+ ref,
30
+ operation: operation,
31
+ value
32
+ };
33
+ const result = await this.translateRefCommands([refCmd], page, refMap, ariaTree);
34
+ const firstResult = result[0];
35
+ translated.push({
36
+ original: cmd,
37
+ alternatives: firstResult.alternatives,
38
+ successful: firstResult.successful
39
+ });
40
+ }
41
+ else {
42
+ // Not a ref command - pass through
43
+ translated.push({
44
+ original: cmd,
45
+ alternatives: [cmd],
46
+ successful: cmd
47
+ });
48
+ }
49
+ }
50
+ return translated;
51
+ }
52
+ /**
53
+ * Translation layer: Convert ref commands to actual Playwright commands
54
+ * Tries multiple selector alternatives until one succeeds
55
+ *
56
+ * Agent outputs:
57
+ * { ref: 'e22', operation: 'fill', value: 'test@test.com' }
58
+ * This generates and tries multiple Playwright alternatives using hierarchical context
59
+ * Returns: The command that worked (for script storage)
60
+ */
61
+ async translateRefCommands(refCommands, page, refMap, ariaTree) {
62
+ const translated = [];
63
+ if (!refMap) {
64
+ this.logger?.(`[Translation] ⚠️ RefMap not available`, 'warn');
65
+ return translated;
66
+ }
67
+ for (const cmd of refCommands) {
68
+ const element = refMap.get(cmd.ref);
69
+ if (!element) {
70
+ this.logger?.(`[Translation] ⚠️ Ref '${cmd.ref}' not found in refMap`, 'warn');
71
+ translated.push({
72
+ original: cmd,
73
+ alternatives: [],
74
+ successful: undefined
75
+ });
76
+ continue;
77
+ }
78
+ // Generate Playwright alternatives using hierarchical context
79
+ const selectors = this.hierarchicalGenerator.generateSelectorsForRef(cmd.ref, refMap, ariaTree);
80
+ // Handle drag specially (needs coordinates)
81
+ if (cmd.operation === 'drag' && cmd.toCoords) {
82
+ const alternatives = this.generateDragCommands(cmd.ref, selectors, cmd.fromCoords || { x: 0, y: 0 }, cmd.toCoords);
83
+ const fromDesc = cmd.fromCoords ? `(${cmd.fromCoords.x},${cmd.fromCoords.y})` : 'center';
84
+ this.logger?.(`[Translation] ref='${cmd.ref}' drag from ${fromDesc} to (${cmd.toCoords.x},${cmd.toCoords.y}) → ${alternatives.length} alternatives`, 'log');
85
+ // Try drag commands
86
+ let successful;
87
+ for (const alt of alternatives) {
88
+ try {
89
+ const func = new Function('page', 'expect', 'return (async () => { ' + alt + ' })()');
90
+ await func(page, global.expect);
91
+ successful = alt;
92
+ this.logger?.(`[Translation] ✓ Success: ${alt.substring(0, 70)}...`, 'log');
93
+ break;
94
+ }
95
+ catch (error) {
96
+ this.logger?.(`[Translation] ✗ Failed: ${alt.substring(0, 70)}... (${error.message.substring(0, 50)})`, 'log');
97
+ continue;
98
+ }
99
+ }
100
+ translated.push({
101
+ original: cmd,
102
+ alternatives,
103
+ successful
104
+ });
105
+ continue;
106
+ }
107
+ const alternatives = this.convertSelectorsToCommands(selectors, cmd.operation, cmd.value);
108
+ this.logger?.(`[Translation] ref='${cmd.ref}' operation='${cmd.operation}' → ${alternatives.length} alternatives`, 'log');
109
+ // Try each alternative until one succeeds
110
+ let successful;
111
+ for (const alt of alternatives) {
112
+ try {
113
+ const func = new Function('page', 'expect', 'return (async () => { ' + alt + ' })()');
114
+ await func(page, global.expect);
115
+ successful = alt;
116
+ this.logger?.(`[Translation] ✓ Success: ${alt.substring(0, 70)}...`, 'log');
117
+ break;
118
+ }
119
+ catch (error) {
120
+ this.logger?.(`[Translation] ✗ Failed: ${alt.substring(0, 70)}... (${error.message.substring(0, 50)})`, 'log');
121
+ continue;
122
+ }
123
+ }
124
+ if (!successful) {
125
+ this.logger?.(`[Translation] ❌ All ${alternatives.length} alternatives failed for ref='${cmd.ref}'`, 'error');
126
+ }
127
+ translated.push({
128
+ original: cmd,
129
+ alternatives,
130
+ successful
131
+ });
132
+ }
133
+ return translated;
134
+ }
135
+ /**
136
+ * Generate drag commands with coordinates
137
+ */
138
+ generateDragCommands(ref, selectors, fromCoords, toCoords) {
139
+ const commands = [];
140
+ // Try top selectors with drag coordinates
141
+ for (const selector of selectors.slice(0, 5)) {
142
+ const locChain = this.selectorToLocatorChain(selector);
143
+ // Drag from element's position + fromCoords offset to absolute toCoords
144
+ commands.push(`await ${locChain}.hover(); ` +
145
+ `await page.mouse.down(); ` +
146
+ `await page.mouse.move(${toCoords.x}, ${toCoords.y}); ` +
147
+ `await page.mouse.up()`);
148
+ }
149
+ return commands;
150
+ }
151
+ /**
152
+ * Convert selectors to full Playwright commands with action
153
+ */
154
+ convertSelectorsToCommands(selectors, operation, value) {
155
+ const commands = [];
156
+ const actionCode = this.getActionCode(operation, value);
157
+ for (const selector of selectors) {
158
+ // Handle different selector formats
159
+ if (selector.includes('>>')) {
160
+ // Chained selector (e.g., "text=Email >> input")
161
+ const parts = selector.split('>>').map(s => s.trim());
162
+ let chain = 'page';
163
+ for (const part of parts) {
164
+ if (part.startsWith('text=')) {
165
+ const text = part.substring(5);
166
+ chain += `.locator('text=${text}')`;
167
+ }
168
+ else if (part.startsWith('nth=')) {
169
+ const index = part.substring(4);
170
+ chain += `.nth(${index})`;
171
+ }
172
+ else if (part === 'first') {
173
+ chain += '.first()';
174
+ }
175
+ else if (part === 'last') {
176
+ chain += '.last()';
177
+ }
178
+ else if (part.startsWith('[') || part.match(/^[a-z]/)) {
179
+ chain += `.locator('${part}')`;
180
+ }
181
+ }
182
+ commands.push(`await ${chain}.${actionCode}`);
183
+ }
184
+ else if (selector.startsWith('getBy')) {
185
+ // Playwright getBy* method
186
+ commands.push(`await page.${selector}.${actionCode}`);
187
+ }
188
+ else if (selector.startsWith('locator(')) {
189
+ // Playwright locator() method
190
+ commands.push(`await page.${selector}.${actionCode}`);
191
+ }
192
+ else {
193
+ // CSS/attribute selector
194
+ commands.push(`await page.locator('${selector}').${actionCode}`);
195
+ }
196
+ }
197
+ return commands;
198
+ }
199
+ /**
200
+ * Convert selector string to locator chain for building commands
201
+ */
202
+ selectorToLocatorChain(selector) {
203
+ if (selector.includes('>>')) {
204
+ const parts = selector.split('>>').map(s => s.trim());
205
+ let chain = 'page';
206
+ for (const part of parts) {
207
+ if (part.startsWith('text=')) {
208
+ chain += `.locator('text=${part.substring(5)}')`;
209
+ }
210
+ else if (part.startsWith('nth=')) {
211
+ chain += `.nth(${part.substring(4)})`;
212
+ }
213
+ else if (part === 'first') {
214
+ chain += '.first()';
215
+ }
216
+ else if (part === 'last') {
217
+ chain += '.last()';
218
+ }
219
+ else {
220
+ chain += `.locator('${part}')`;
221
+ }
222
+ }
223
+ return chain;
224
+ }
225
+ else if (selector.startsWith('getBy')) {
226
+ return `page.${selector}`;
227
+ }
228
+ else if (selector.startsWith('locator(')) {
229
+ return `page.${selector}`;
230
+ }
231
+ else {
232
+ return `page.locator('${selector}')`;
233
+ }
234
+ }
235
+ getActionCode(operation, value) {
236
+ switch (operation.toLowerCase()) {
237
+ // Common interactions
238
+ case 'click':
239
+ return 'click()';
240
+ case 'doubleclick':
241
+ return 'dblclick()';
242
+ case 'rightclick':
243
+ return 'click({ button: "right" })';
244
+ // Input operations
245
+ case 'fill':
246
+ return `fill('${this.escape(value || '')}')`;
247
+ case 'type':
248
+ return `type('${this.escape(value || '')}')`;
249
+ case 'clear':
250
+ return 'clear()';
251
+ case 'press':
252
+ return `press('${this.escape(value || 'Enter')}')`;
253
+ // Selection operations
254
+ case 'select':
255
+ return `selectOption('${this.escape(value || '')}')`;
256
+ case 'check':
257
+ return 'check()';
258
+ case 'uncheck':
259
+ return 'uncheck()';
260
+ // Focus operations
261
+ case 'hover':
262
+ return 'hover()';
263
+ case 'focus':
264
+ return 'focus()';
265
+ case 'blur':
266
+ return 'blur()';
267
+ default:
268
+ return `${operation}()`;
269
+ }
270
+ }
271
+ escape(str) {
272
+ return str.replace(/'/g, "\\'").replace(/"/g, '\\"');
273
+ }
274
+ }
275
+ exports.RefTranslator = RefTranslator;
276
+ //# sourceMappingURL=ref-translator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-translator.js","sourceRoot":"","sources":["../../src/utils/ref-translator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mEAAwE;AAGxE,MAAa,aAAa;IAIxB,YAAY,MAAoE;QAC9E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,IAAI,qDAA6B,CAAC,MAAM,CAAC,CAAC;IACzE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,uBAAuB,CAC3B,QAAkB,EAClB,IAAS,EACT,MA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AC;YAC/C,KAAK,MAAM;gBACT,OAAO,SAAS,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC;YAC/C,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,OAAO;gBACV,OAAO,UAAU,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAErD,uBAAuB;YACvB,KAAK,QAAQ;gBACX,OAAO,iBAAiB,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC;YACvD,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,SAAS;gBACZ,OAAO,WAAW,CAAC;YAErB,mBAAmB;YACnB,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,MAAM;gBACT,OAAO,QAAQ,CAAC;YAElB;gBACE,OAAO,GAAG,SAAS,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,GAAW;QACxB,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;CACF;AA7SD,sCA6SC"}
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "testchimp-runner-core",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "Core TestChimp functionality for test generation and AI repair",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist/",
9
+ "env.prod",
10
+ "env.staging"
11
+ ],
7
12
  "scripts": {
8
13
  "build": "tsc",
9
14
  "watch": "tsc --watch",
package/RELEASE_0.0.26.md DELETED
@@ -1,165 +0,0 @@
1
- # Release 0.0.26 - Fix Orchestrator Reasoning Logs
2
-
3
- ## Summary
4
- Fixed bug where orchestrator reasoning logs (💭 REASONING, 🧠 SELF-REFLECTION, etc.) were not appearing in VS Code output channel due to outputChannel being lost during service recreation.
5
-
6
- ## Bug Fixed
7
-
8
- ### The Problem
9
- Orchestrator reasoning logs were only showing in `console.log()` (debug console), not in:
10
- - ❌ VS Code "TestChimp Agent" output channel
11
- - ❌ Log files
12
-
13
- Users couldn't see what the agent was thinking!
14
-
15
- **Root Cause:**
16
- When `setAuthConfig()` was called, it recreated `ScenarioService`, which lost the `outputChannel` reference. Workers were then created without access to the output channel, causing all orchestrator logs to fall back to `console.log()` only.
17
-
18
- **Call sequence that caused the bug:**
19
- 1. `embeddedService.initialize()` → calls `service.setOutputChannel()` ✅
20
- 2. Then calls `service.setAuthConfig()` which:
21
- - Recreates `ScenarioService` ❌ outputChannel lost!
22
- - Calls `scenarioService.initialize()` → creates workers without outputChannel
23
- 3. Orchestrator logs → `console.log()` only (not visible in output channel)
24
-
25
- ## Solution
26
-
27
- ### Changes in runner-core
28
-
29
- **TestChimpService (`index.ts`):**
30
-
31
- 1. **Store outputChannel** in private field:
32
- ```typescript
33
- private outputChannel?: any; // Store outputChannel to preserve it across service recreations
34
- ```
35
-
36
- 2. **Preserve it in setOutputChannel()**:
37
- ```typescript
38
- setOutputChannel(outputChannel: any): void {
39
- this.outputChannel = outputChannel; // Store for future use
40
- if (typeof this.scenarioService?.setOutputChannel === 'function') {
41
- this.scenarioService.setOutputChannel(outputChannel);
42
- }
43
- }
44
- ```
45
-
46
- 3. **Reapply after service recreation** (in both `setAuthConfig()` and `setBackendUrl()`):
47
- ```typescript
48
- // Reapply outputChannel if we have one (critical for orchestrator logs)
49
- if (this.outputChannel) {
50
- this.scenarioService.setOutputChannel(this.outputChannel);
51
- }
52
- ```
53
-
54
- ### Result
55
-
56
- Now orchestrator logs flow correctly:
57
- ```
58
- Orchestrator (runner-core)
59
- ↓ this.logger?.()
60
- ScenarioWorker.log()
61
- ↓ outputChannel.appendLine()
62
- VS Code Output Channel ✅
63
- ↓ dual-write
64
- Log File ✅
65
- ```
66
-
67
- ## What Now Appears in Output Channel
68
-
69
- **All Environments:**
70
- - ✅ `💭 REASONING: [agent's reasoning]`
71
- - ✅ `🧠 SELF-REFLECTION: [guidance for next iteration]`
72
- - ✅ `💡 Why: [command reasoning]`
73
- - ✅ `🔧 TOOLS: [tool usage]`
74
- - ✅ `🚧 BLOCKER: [blocker detection]`
75
- - ✅ `📝 COMMANDS: [commands to execute]`
76
- - ✅ `✓ [success messages]`
77
- - ✅ `✗ [failure messages]`
78
-
79
- **Development Only:**
80
- - ✅ `💰 Reporting token usage: X + Y`
81
-
82
- **Staging/Production (Suppressed from channel, but in file):**
83
- - ❌ Token usage logs (still tracked, just not displayed)
84
-
85
- ## Testing the Fix
86
-
87
- To verify reasoning logs appear:
88
- 1. Run test generation in VS Code
89
- 2. Check "TestChimp Agent" output channel
90
- 3. Look for `💭 REASONING`, `🧠 SELF-REFLECTION`, etc.
91
- 4. Check log file has complete information
92
-
93
- ## Files Modified
94
-
95
- **runner-core:**
96
- - `/src/index.ts` - Store and reapply outputChannel across service recreations
97
-
98
- **vs-extension:**
99
- - `/package.json` - Updated to use `^0.0.26`
100
-
101
- **github-action:**
102
- - `/package.json` - Updated to use `^0.0.26`
103
-
104
- ## Published to npm
105
-
106
- ```
107
- ✅ Published: testchimp-runner-core@0.0.26
108
- 📦 Package Size: 245.9 kB
109
- 📋 Registry: https://registry.npmjs.org/
110
- 🔢 Files: 166
111
- ```
112
-
113
- ## Verification
114
-
115
- **vs-extension:**
116
- ```
117
- testchimp-vs-extension@0.0.8
118
- └── testchimp-runner-core@0.0.26 ✅
119
- ```
120
-
121
- **github-action:**
122
- ```
123
- testchimp-runner-action@1.0.18
124
- └── testchimp-runner-core@0.0.26 ✅
125
- ```
126
-
127
- ## Build Status
128
-
129
- ✅ **runner-core** - Published to npm
130
- ✅ **vs-extension** - Updated and built (492 KiB)
131
- ✅ **github-action** - Updated and built (1151 KiB)
132
-
133
- ## Backward Compatibility
134
-
135
- ✅ Fully backward compatible
136
- - No API changes
137
- - Only fixes a bug in log routing
138
- - All functionality preserved
139
-
140
- ## Complete Feature Set in 0.0.26
141
-
142
- This version includes all improvements made today:
143
- 1. ✅ Semantic selector preference (getByRole, getByLabel, etc.)
144
- 2. ✅ Playwright expect() assertions instead of manual checks
145
- 3. ✅ Script cleanup feature (removes redundancies)
146
- 4. ✅ Fixed comment placement in generated scripts
147
- 5. ✅ Focused step execution (no extra assertions)
148
- 6. ✅ Environment-aware log filtering (in vs-extension)
149
- 7. ✅ **Orchestrator reasoning logs in output channel** (NEW in 0.0.26)
150
-
151
- ## Next Steps
152
-
153
- For future service recreations, the pattern to follow:
154
- ```typescript
155
- // When recreating a service, reapply stored configuration:
156
- if (this.logger) {
157
- this.newService.setLogger(this.logger);
158
- }
159
- if (this.outputChannel) {
160
- this.newService.setOutputChannel(this.outputChannel);
161
- }
162
- ```
163
-
164
- This ensures configuration persists across service lifecycles.
165
-