From 54869cabd0d7e7259a7f89dded839ea99f91a36d Mon Sep 17 00:00:00 2001 From: BB-fat <1056871944@qq.com> Date: Thu, 13 Aug 2026 17:56:16 +0000 Subject: [PATCH] fix(dsh-plugin-browserskill): include the bsk error hint in the thrown message The daemon's JSON error envelope carries an actionable hint (e.g. 'choose an input, textarea, or contenteditable element from the latest snapshot'), but the thrown BskError only embedded the message field, so the model-facing error text never showed the hint. Append it. --- packages/dsh-plugin-browserskill/src/runner.ts | 5 ++++- packages/dsh-plugin-browserskill/tests/runner.test.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/dsh-plugin-browserskill/src/runner.ts b/packages/dsh-plugin-browserskill/src/runner.ts index 3f05426..c747177 100644 --- a/packages/dsh-plugin-browserskill/src/runner.ts +++ b/packages/dsh-plugin-browserskill/src/runner.ts @@ -177,7 +177,10 @@ export function parseBskJson(result: BskRunResult, commandLabel: string): unknow } const message = parsed?.message ?? (result.stderr.trim() || body || `bsk ${commandLabel} failed`); - throw new BskError(`bsk ${commandLabel} failed: ${message}`, { + // Surface the envelope's actionable hint in the model-facing message; a + // hint the model cannot see cannot be followed. + const withHint = parsed?.hint !== undefined ? `${message} (hint: ${parsed.hint})` : message; + throw new BskError(`bsk ${commandLabel} failed: ${withHint}`, { code: parsed?.code, hint: parsed?.hint, exitCode: result.code, diff --git a/packages/dsh-plugin-browserskill/tests/runner.test.ts b/packages/dsh-plugin-browserskill/tests/runner.test.ts index 35dc279..dabe046 100644 --- a/packages/dsh-plugin-browserskill/tests/runner.test.ts +++ b/packages/dsh-plugin-browserskill/tests/runner.test.ts @@ -109,6 +109,7 @@ describe("parseBskJson", () => { exitCode: 3, }); expect((error as Error).message).toContain("no browser connected"); + expect((error as Error).message).toContain("hint: open Chrome"); } });