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.
This commit is contained in:
BB-fat
2026-08-13 17:56:16 +00:00
parent 2de7c5c6ff
commit 54869cabd0
2 changed files with 5 additions and 1 deletions
@@ -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,
@@ -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");
}
});