donobu 5.27.3 → 5.27.4

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.
@@ -21,6 +21,7 @@ const ChangeWebBrowserTabTool_1 = require("../../tools/ChangeWebBrowserTabTool")
21
21
  const CreateBrowserCookieReportTool_1 = require("../../tools/CreateBrowserCookieReportTool");
22
22
  const GoToWebpageTool_1 = require("../../tools/GoToWebpageTool");
23
23
  const RunAccessibilityTestTool_1 = require("../../tools/RunAccessibilityTestTool");
24
+ const ansi_1 = require("../../utils/ansi");
24
25
  const BrowserUtils_1 = require("../../utils/BrowserUtils");
25
26
  const Logger_1 = require("../../utils/Logger");
26
27
  const MiscUtils_1 = require("../../utils/MiscUtils");
@@ -241,7 +242,11 @@ Valid options:
241
242
  // All retry attempts exhausted
242
243
  throw new ToolCallFailedException_1.ToolCallFailedException(AssertTool_1.AssertTool.NAME, {
243
244
  isSuccessful: false,
244
- forLlm: `Assertion FAILED (cached) for: ${assertion}\nPlaywright Error: ${lastError?.message}`,
245
+ // Strip ANSI: Playwright matchers style their messages for the
246
+ // terminal, but this string flows into JSON-stringified exception
247
+ // messages, the LLM, and HTML/markdown reports — places where the
248
+ // codes never render and just become visible junk.
249
+ forLlm: `Assertion FAILED (cached) for: ${assertion}\nPlaywright Error: ${(0, ansi_1.stripAnsi)(lastError?.message ?? '')}`,
245
250
  metadata: {
246
251
  cached: true,
247
252
  steps: cached.steps,
@@ -7,7 +7,6 @@
7
7
  * reporter and the auto-heal orchestrator) own I/O.
8
8
  */
9
9
  import type { DonobuReport } from './model';
10
- export declare function stripAnsi(str: string): string;
11
10
  interface TreatmentPlanRecord {
12
11
  generatedAtIso?: string;
13
12
  plan: {
@@ -8,18 +8,15 @@
8
8
  * reporter and the auto-heal orchestrator) own I/O.
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.stripAnsi = stripAnsi;
12
11
  exports.loadTriageData = loadTriageData;
13
12
  exports.renderHtml = renderHtml;
14
13
  const fs_1 = require("fs");
15
14
  const path_1 = require("path");
15
+ const ansi_1 = require("../utils/ansi");
16
16
  const reportWalk_1 = require("./reportWalk");
17
17
  // ---------------------------------------------------------------------------
18
18
  // Helpers
19
19
  // ---------------------------------------------------------------------------
20
- function stripAnsi(str) {
21
- return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
22
- }
23
20
  /**
24
21
  * Convert ANSI SGR color codes to HTML spans. Handles the subset Playwright's
25
22
  * expect formatter emits: red (31), green (32), dim (2), and resets (0/22/39).
@@ -559,7 +556,7 @@ function renderErrors(errors) {
559
556
  html += `<pre class="snippet-block">${ansiToHtml(err.snippet)}</pre>`;
560
557
  }
561
558
  if (err.stack && err.stack !== err.message) {
562
- html += `<details class="stack-details"><summary>Stack trace</summary><pre class="stack-block">${esc(stripAnsi(err.stack))}</pre></details>`;
559
+ html += `<details class="stack-details"><summary>Stack trace</summary><pre class="stack-block">${esc((0, ansi_1.stripAnsi)(err.stack))}</pre></details>`;
563
560
  }
564
561
  }
565
562
  return html;
@@ -9,7 +9,7 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.renderMarkdown = renderMarkdown;
12
- const render_1 = require("./render");
12
+ const ansi_1 = require("../utils/ansi");
13
13
  const reportWalk_1 = require("./reportWalk");
14
14
  function formatDuration(ms) {
15
15
  if (ms < 1000) {
@@ -154,7 +154,7 @@ function renderMarkdown(report) {
154
154
  markdown += `\n<details>\n<summary>⚠️ Error Details</summary>\n\n`;
155
155
  markdown += `\`\`\`\n${result.error.message || 'No error message available'}\n\`\`\`\n\n`;
156
156
  if (result.error.snippet) {
157
- markdown += `**Code Snippet**:\n\`\`\`\n${(0, render_1.stripAnsi)(result.error.snippet)}\n\`\`\`\n\n`;
157
+ markdown += `**Code Snippet**:\n\`\`\`\n${(0, ansi_1.stripAnsi)(result.error.snippet)}\n\`\`\`\n\n`;
158
158
  }
159
159
  markdown += `</details>\n\n`;
160
160
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Remove ANSI escape sequences (color/style codes) from a string.
3
+ *
4
+ * Playwright matchers emit terminal-styled errors. Once those messages cross
5
+ * into Donobu data flows — `forLlm` strings sent to the model, JSON-stringified
6
+ * exception messages, persisted reports — the codes never render as colors and
7
+ * just become visible junk (worse: `JSON.stringify` escapes the ESC byte into
8
+ * the 6-char literal `\u001b[..]m`). Strip at the boundary.
9
+ */
10
+ export declare function stripAnsi(str: string): string;
11
+ //# sourceMappingURL=ansi.d.ts.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripAnsi = stripAnsi;
4
+ /**
5
+ * Remove ANSI escape sequences (color/style codes) from a string.
6
+ *
7
+ * Playwright matchers emit terminal-styled errors. Once those messages cross
8
+ * into Donobu data flows — `forLlm` strings sent to the model, JSON-stringified
9
+ * exception messages, persisted reports — the codes never render as colors and
10
+ * just become visible junk (worse: `JSON.stringify` escapes the ESC byte into
11
+ * the 6-char literal `\u001b[..]m`). Strip at the boundary.
12
+ */
13
+ function stripAnsi(str) {
14
+ return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
15
+ }
16
+ //# sourceMappingURL=ansi.js.map
@@ -21,6 +21,7 @@ const ChangeWebBrowserTabTool_1 = require("../../tools/ChangeWebBrowserTabTool")
21
21
  const CreateBrowserCookieReportTool_1 = require("../../tools/CreateBrowserCookieReportTool");
22
22
  const GoToWebpageTool_1 = require("../../tools/GoToWebpageTool");
23
23
  const RunAccessibilityTestTool_1 = require("../../tools/RunAccessibilityTestTool");
24
+ const ansi_1 = require("../../utils/ansi");
24
25
  const BrowserUtils_1 = require("../../utils/BrowserUtils");
25
26
  const Logger_1 = require("../../utils/Logger");
26
27
  const MiscUtils_1 = require("../../utils/MiscUtils");
@@ -241,7 +242,11 @@ Valid options:
241
242
  // All retry attempts exhausted
242
243
  throw new ToolCallFailedException_1.ToolCallFailedException(AssertTool_1.AssertTool.NAME, {
243
244
  isSuccessful: false,
244
- forLlm: `Assertion FAILED (cached) for: ${assertion}\nPlaywright Error: ${lastError?.message}`,
245
+ // Strip ANSI: Playwright matchers style their messages for the
246
+ // terminal, but this string flows into JSON-stringified exception
247
+ // messages, the LLM, and HTML/markdown reports — places where the
248
+ // codes never render and just become visible junk.
249
+ forLlm: `Assertion FAILED (cached) for: ${assertion}\nPlaywright Error: ${(0, ansi_1.stripAnsi)(lastError?.message ?? '')}`,
245
250
  metadata: {
246
251
  cached: true,
247
252
  steps: cached.steps,
@@ -7,7 +7,6 @@
7
7
  * reporter and the auto-heal orchestrator) own I/O.
8
8
  */
9
9
  import type { DonobuReport } from './model';
10
- export declare function stripAnsi(str: string): string;
11
10
  interface TreatmentPlanRecord {
12
11
  generatedAtIso?: string;
13
12
  plan: {
@@ -8,18 +8,15 @@
8
8
  * reporter and the auto-heal orchestrator) own I/O.
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.stripAnsi = stripAnsi;
12
11
  exports.loadTriageData = loadTriageData;
13
12
  exports.renderHtml = renderHtml;
14
13
  const fs_1 = require("fs");
15
14
  const path_1 = require("path");
15
+ const ansi_1 = require("../utils/ansi");
16
16
  const reportWalk_1 = require("./reportWalk");
17
17
  // ---------------------------------------------------------------------------
18
18
  // Helpers
19
19
  // ---------------------------------------------------------------------------
20
- function stripAnsi(str) {
21
- return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
22
- }
23
20
  /**
24
21
  * Convert ANSI SGR color codes to HTML spans. Handles the subset Playwright's
25
22
  * expect formatter emits: red (31), green (32), dim (2), and resets (0/22/39).
@@ -559,7 +556,7 @@ function renderErrors(errors) {
559
556
  html += `<pre class="snippet-block">${ansiToHtml(err.snippet)}</pre>`;
560
557
  }
561
558
  if (err.stack && err.stack !== err.message) {
562
- html += `<details class="stack-details"><summary>Stack trace</summary><pre class="stack-block">${esc(stripAnsi(err.stack))}</pre></details>`;
559
+ html += `<details class="stack-details"><summary>Stack trace</summary><pre class="stack-block">${esc((0, ansi_1.stripAnsi)(err.stack))}</pre></details>`;
563
560
  }
564
561
  }
565
562
  return html;
@@ -9,7 +9,7 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.renderMarkdown = renderMarkdown;
12
- const render_1 = require("./render");
12
+ const ansi_1 = require("../utils/ansi");
13
13
  const reportWalk_1 = require("./reportWalk");
14
14
  function formatDuration(ms) {
15
15
  if (ms < 1000) {
@@ -154,7 +154,7 @@ function renderMarkdown(report) {
154
154
  markdown += `\n<details>\n<summary>⚠️ Error Details</summary>\n\n`;
155
155
  markdown += `\`\`\`\n${result.error.message || 'No error message available'}\n\`\`\`\n\n`;
156
156
  if (result.error.snippet) {
157
- markdown += `**Code Snippet**:\n\`\`\`\n${(0, render_1.stripAnsi)(result.error.snippet)}\n\`\`\`\n\n`;
157
+ markdown += `**Code Snippet**:\n\`\`\`\n${(0, ansi_1.stripAnsi)(result.error.snippet)}\n\`\`\`\n\n`;
158
158
  }
159
159
  markdown += `</details>\n\n`;
160
160
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Remove ANSI escape sequences (color/style codes) from a string.
3
+ *
4
+ * Playwright matchers emit terminal-styled errors. Once those messages cross
5
+ * into Donobu data flows — `forLlm` strings sent to the model, JSON-stringified
6
+ * exception messages, persisted reports — the codes never render as colors and
7
+ * just become visible junk (worse: `JSON.stringify` escapes the ESC byte into
8
+ * the 6-char literal `\u001b[..]m`). Strip at the boundary.
9
+ */
10
+ export declare function stripAnsi(str: string): string;
11
+ //# sourceMappingURL=ansi.d.ts.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripAnsi = stripAnsi;
4
+ /**
5
+ * Remove ANSI escape sequences (color/style codes) from a string.
6
+ *
7
+ * Playwright matchers emit terminal-styled errors. Once those messages cross
8
+ * into Donobu data flows — `forLlm` strings sent to the model, JSON-stringified
9
+ * exception messages, persisted reports — the codes never render as colors and
10
+ * just become visible junk (worse: `JSON.stringify` escapes the ESC byte into
11
+ * the 6-char literal `\u001b[..]m`). Strip at the boundary.
12
+ */
13
+ function stripAnsi(str) {
14
+ return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
15
+ }
16
+ //# sourceMappingURL=ansi.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donobu",
3
- "version": "5.27.3",
3
+ "version": "5.27.4",
4
4
  "description": "Create browser automations with an LLM agent and replay them as Playwright scripts.",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/esm/main.js",