graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
test(gui): rendered-anchor regression tests for bold-wrapped bare URLs (#729)
justrach4fb8469903fd
diff --git a/bun.lock b/bun.lockindex 04b70f0e..e1d6bf94 100644--- a/bun.lock+++ b/bun.lock@@ -38,6 +38,7 @@},"devDependencies": {"@eslint/js": "^9.39.4",+ "@happy-dom/global-registrator": "^20.13.2","@rolldown/plugin-babel": "^0.2.3","@tailwindcss/vite": "^4.2.2","@tauri-apps/cli": "^2.10.1",@@ -79,12 +80,20 @@},"sdk/ts": {"name": "@codegraff/sdk",- "version": "0.3.1",+ "version": "0.4.0","devDependencies": {"@types/node": "^22.10.2","bun-types": "^1.3.11","typescript": "~5.9.3",},+ "optionalDependencies": {+ "@codegraff/graff-darwin-arm64": "0.4.0",+ "@codegraff/graff-darwin-x64": "0.4.0",+ "@codegraff/graff-linux-arm64": "0.4.0",+ "@codegraff/graff-linux-x64": "0.4.0",+ "@codegraff/graff-win32-arm64": "0.4.0",+ "@codegraff/graff-win32-x64": "0.4.0",+ },},},"packages": {@@ -198,6 +207,8 @@"@fontsource-variable/geist": ["@fontsource-variable/[email protected]", "", {}, "sha512-TP+QSBG3wxKGPE33CbMy/L0Nu3qvJ6Fy81Yc4LnQ95xH+i+cfEp8fyU8/kfV14YwszxIFPhnoMTbjL71waVpyQ=="],+ "@happy-dom/global-registrator": ["@happy-dom/[email protected]", "", { "dependencies": { "@types/node": ">=20.0.0", "happy-dom": "^20.13.2" } }, "sha512-pGO7WhgHVLi7mi7zCLyJ+FkTad2aPTcjUXhRbgA4T5n1vLRJ/9uw3EsLieScNSX6HOfPF947bOP7N42l+KrWjg=="],+"@hono/node-server": ["@hono/[email protected]", "", { "peerDependencies": { "hono": "^4" } }, "sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw=="],"@humanfs/core": ["@humanfs/[email protected]", "", { "dependencies": { "@humanfs/types": "^0.15.0" } }, "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA=="],@@ -518,6 +529,10 @@"@types/validate-npm-package-name": ["@types/[email protected]", "", {}, "sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw=="],+ "@types/whatwg-mimetype": ["@types/[email protected]", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="],++ "@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],+"@typescript-eslint/eslint-plugin": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.61.1", "@typescript-eslint/type-utils": "8.61.1", "@typescript-eslint/utils": "8.61.1", "@typescript-eslint/visitor-keys": "8.61.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.61.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-ZPlVl3PB3et/59Ne0fv/sci6ZXz4T4Hp4nTJ56i/Y0gR89ARb+KphojTq6j+56E5PIezmOIOOWyY+aWQFd+IkQ=="],"@typescript-eslint/parser": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.61.1", "@typescript-eslint/types": "8.61.1", "@typescript-eslint/typescript-estree": "8.61.1", "@typescript-eslint/visitor-keys": "8.61.1", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-PJ5vePq5/ognBbrIcoC5+SHO5dfpeLPzP9FpLkzWrguoYQEeeSjlJpVwOpo1JRSTEi7dRcwNy4h4dzV70PqHcg=="],@@ -600,6 +615,8 @@"browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.10.12", "caniuse-lite": "^1.0.30001782", "electron-to-chromium": "^1.5.328", "node-releases": "^2.0.36", "update-browserslist-db": "^1.2.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg=="],+ "buffer-image-size": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-nEh+kZOPY1w+gcCMobZ6ETUp9WfibndnosbpwB1iJk/8Gt5ZF2bhS6+B6bPYz424KtwsR6Rflc3tCz1/ghX2dQ=="],+"bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],"bundle-name": ["[email protected]", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="],@@ -818,7 +835,7 @@"enquirer": ["[email protected]", "", { "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" } }, "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ=="],- "entities": ["[email protected]", "", {}, "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="],+ "entities": ["[email protected]", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="],"env-paths": ["[email protected]", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="],@@ -960,6 +977,8 @@"hachure-fill": ["[email protected]", "", {}, "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg=="],+ "happy-dom": ["[email protected]", "", { "dependencies": { "@types/node": ">=20.0.0", "@types/whatwg-mimetype": "^3.0.2", "@types/ws": "^8.18.1", "buffer-image-size": "^0.6.4", "entities": "^7.0.1", "whatwg-mimetype": "^3.0.0", "ws": "^8.21.0" } }, "sha512-VC9HoEaT3Jf3K/1g/GjMYGAZCCg+ULgGVcXJlAeSzdTj8mIoPJRp14KVclP5gpUcF/kauuaVB2ri2/WxXbl4vg=="],+"has-bigints": ["[email protected]", "", {}, "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg=="],"has-flag": ["[email protected]", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],@@ -1512,6 +1531,8 @@"web-streams-polyfill": ["[email protected]", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="],+ "whatwg-mimetype": ["[email protected]", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="],+"which": ["[email protected]", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],"which-boxed-primitive": ["[email protected]", "", { "dependencies": { "is-bigint": "^1.1.0", "is-boolean-object": "^1.2.1", "is-number-object": "^1.1.1", "is-string": "^1.1.1", "is-symbol": "^1.1.1" } }, "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA=="],@@ -1526,6 +1547,8 @@"wrappy": ["[email protected]", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],+ "ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],+"wsl-utils": ["[email protected]", "", { "dependencies": { "is-wsl": "^3.1.0", "powershell-utils": "^0.1.0" } }, "sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg=="],"yallist": ["[email protected]", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],@@ -1558,6 +1581,8 @@"@eslint/eslintrc/globals": ["[email protected]", "", {}, "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ=="],+ "@happy-dom/global-registrator/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA=="],+"@modelcontextprotocol/sdk/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],"@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/[email protected]", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" }, "bundled": true }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="],@@ -1574,6 +1599,8 @@"@ts-morph/common/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="],+ "@types/ws/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA=="],+"@typescript-eslint/eslint-plugin/ignore": ["[email protected]", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],"@typescript-eslint/typescript-estree/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="],@@ -1588,6 +1615,8 @@"body-parser/iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],+ "buffer-image-size/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA=="],+"bun-types/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA=="],"coa/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="],@@ -1614,12 +1643,16 @@"dom-serializer/domelementtype": ["[email protected]", "", {}, "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="],+ "dom-serializer/entities": ["[email protected]", "", {}, "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="],+"dot-prop/is-obj": ["[email protected]", "", {}, "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="],"enquirer/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],"fast-glob/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],+ "happy-dom/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA=="],+"is-inside-container/is-docker": ["[email protected]", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="],"log-symbols/chalk": ["[email protected]", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],@@ -1674,14 +1707,20 @@"@dotenvx/dotenvx/which/isexe": ["[email protected]", "", {}, "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w=="],+ "@happy-dom/global-registrator/@types/node/undici-types": ["[email protected]", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],+"@modelcontextprotocol/sdk/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],"@ts-morph/common/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g=="],+ "@types/ws/@types/node/undici-types": ["[email protected]", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],+"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g=="],"ajv-formats/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],+ "buffer-image-size/@types/node/undici-types": ["[email protected]", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],+"bun-types/@types/node/undici-types": ["[email protected]", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],"coa/chalk/ansi-styles": ["[email protected]", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],@@ -1702,6 +1741,8 @@"enquirer/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],+ "happy-dom/@types/node/undici-types": ["[email protected]", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],+"pkg-up/find-up/locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" } }, "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A=="],"svgo/chalk/ansi-styles": ["[email protected]", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],diff --git a/gui/package.json b/gui/package.jsonindex 5f8a4383..b3bbf379 100644--- a/gui/package.json+++ b/gui/package.json@@ -45,6 +45,7 @@},"devDependencies": {"@eslint/js": "^9.39.4",+ "@happy-dom/global-registrator": "^20.13.2","@rolldown/plugin-babel": "^0.2.3","@tailwindcss/vite": "^4.2.2","@tauri-apps/cli": "^2.10.1",diff --git a/gui/src/components/chat/ChatMarkdown.test.tsx b/gui/src/components/chat/ChatMarkdown.test.tsxnew file mode 100644index 00000000..a877e28c--- /dev/null+++ b/gui/src/components/chat/ChatMarkdown.test.tsx@@ -0,0 +1,116 @@+import { afterAll, beforeAll, expect, mock, test } from "bun:test";+import { act } from "react";++import { CHAT_BODY_TONE_CLASS } from "./constants/chatStyles";++// #729 asked for the final rendered assistant-message anchor, not only the+// matcher: the component the assistant row mounts (ChatMessageRow renders an+// assistant message as <article><ChatMarkdown/></article>), clicked the way a+// user clicks it, with the argument that reaches the open-link path captured+// verbatim. ChatMarkdown rather than ChatMessageRow because module mocks are+// process-wide under bun test and an earlier file may leave the desktop client+// as a partial stub; the row imports an export such a stub cannot gain.+const ISSUE_URL = "https://github.com/justrach/codegraff/issues/728";++const opened: string[] = [];++mock.module("./utils/chatOpen", () => ({+ openUrlFromChat: (url: string) => {+ opened.push(url);+ },+ openFilePathFromChat: async () => {},+}));++let unregisterDom: (() => Promise<void>) | null = null;+let createRoot: typeof import("react-dom/client").createRoot;+let ChatMarkdown: typeof import("./ChatMarkdown").ChatMarkdown;++beforeAll(async () => {+ // The DOM is registered before react-dom/client and the component are+ // loaded, so both see a real document from the start.+ const { GlobalRegistrator } = await import("@happy-dom/global-registrator");+ GlobalRegistrator.register();+ unregisterDom = () => GlobalRegistrator.unregister();+ // happy-dom leaves document.compatMode undefined; KaTeX (pulled in by the+ // renderer) reads it at load and warns about quirks mode unless it says+ // standards mode.+ Object.defineProperty(document, "compatMode", { value: "CSS1Compat", configurable: true });+ (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+ ({ createRoot } = await import("react-dom/client"));+ ({ ChatMarkdown } = await import("./ChatMarkdown"));+});++afterAll(async () => {+ await unregisterDom?.();+});++// Mounts the assistant message body with the props ChatMessageRow passes it.+function mountAssistantMessage(text: string) {+ const container = document.createElement("div");+ document.body.appendChild(container);+ const root = createRoot(container);+ act(() => {+ root.render(+ <ChatMarkdown+ text={text}+ className={`cg-stream-in ${CHAT_BODY_TONE_CLASS}`}+ workspacePath={null}+ />,+ );+ });+ return {+ container,+ unmount: () => {+ act(() => root.unmount());+ container.remove();+ },+ };+}++test("assistant message: a bold-wrapped bare URL renders bold, and both the anchor text and the open target are exactly the URL", () => {+ opened.length = 0;+ const { container, unmount } = mountAssistantMessage(`**${ISSUE_URL}**`);+ try {+ const anchor = container.querySelector("button");+ expect(anchor).not.toBeNull();+ // Neither delimiter pair survives as text: the whole message reads as the URL.+ expect(anchor!.textContent).toBe(ISSUE_URL);+ expect(container.textContent).toBe(ISSUE_URL);+ expect(anchor!.getAttribute("title")).toBe(ISSUE_URL);+ // The emphasis renders as bold around the anchor.+ expect(anchor!.closest(".font-medium")).not.toBeNull();++ // Cmd-click and a plain click both hand the open-link path exactly the URL.+ act(() => {+ anchor!.dispatchEvent(+ new MouseEvent("click", { bubbles: true, cancelable: true, metaKey: true }),+ );+ });+ act(() => {+ anchor!.click();+ });+ expect(opened).toEqual([ISSUE_URL, ISSUE_URL]);+ } finally {+ unmount();+ }+});++test("assistant message: a bold-wrapped URL inside a sentence keeps punctuation and parentheses out of the target", () => {+ opened.length = 0;+ const { container, unmount } = mountAssistantMessage(+ `Filed as **${ISSUE_URL}** (P0, see **${ISSUE_URL}**).`,+ );+ try {+ const anchors = Array.from(container.querySelectorAll("button"));+ expect(anchors.map((anchor) => anchor.textContent)).toEqual([ISSUE_URL, ISSUE_URL]);+ expect(container.textContent).toBe(`Filed as ${ISSUE_URL} (P0, see ${ISSUE_URL}).`);+ for (const anchor of anchors) {+ act(() => {+ anchor.click();+ });+ }+ expect(opened).toEqual([ISSUE_URL, ISSUE_URL]);+ } finally {+ unmount();+ }+});diff --git a/gui/src/components/chat/markdown/MarkdownRenderer.test.tsx b/gui/src/components/chat/markdown/MarkdownRenderer.test.tsxindex 8546bc22..76b7d367 100644--- a/gui/src/components/chat/markdown/MarkdownRenderer.test.tsx+++ b/gui/src/components/chat/markdown/MarkdownRenderer.test.tsx@@ -88,6 +88,47 @@ test("keeps a bold-wrapped URL bold and its target clean", () => {expect(html).not.toContain("**");});+// #729: the exact report — a bare GitHub issue URL directly wrapped in bold.+// The anchor text and the target must both be the URL alone; the delimiter+// pairs are markup (bold), never text and never part of the link.+const ISSUE_URL = "https://github.com/justrach/codegraff/issues/728";++test("#729: a bold-wrapped bare URL renders bold with the anchor text and target exactly the URL", () => {+ const html = renderToStaticMarkup(<MarkdownRenderer text={`**${ISSUE_URL}**`} />);+ expect(html).toContain("font-medium");+ expect(html).toContain(`>${ISSUE_URL}</button>`);+ expect(linkTargets(html)).toEqual([ISSUE_URL]);+ expect(html).not.toContain("*");+});++test("#729: bold-wrapped URLs next to punctuation, parentheses, and list markers stay clean", () => {+ const texts = [+ `Filed **${ISSUE_URL}**.`,+ `(see **${ISSUE_URL}**)`,+ `- **${ISSUE_URL}** — P0`,+ `**Filed: ${ISSUE_URL}** and **${ISSUE_URL}**`,+ ];+ for (const text of texts) {+ const html = renderToStaticMarkup(<MarkdownRenderer text={text} />);+ const targets = linkTargets(html);+ expect(targets.length).toBeGreaterThan(0);+ for (const target of targets) {+ expect(target).toBe(ISSUE_URL);+ }+ expect(html).not.toContain("**");+ }+});++test("#729: no streaming prefix of a bold-wrapped URL leaks a delimiter into the target", () => {+ const text = `Filed **${ISSUE_URL}** for the crash.`;+ for (let length = 1; length <= text.length; length += 1) {+ const html = renderToStaticMarkup(<MarkdownRenderer text={text.slice(0, length)} />);+ for (const target of linkTargets(html)) {+ expect(target).not.toMatch(/(\*\*|__|~~)$/u);+ }+ }+});+test("renders unsafe markdown link schemes as plain text", () => {const html = renderToStaticMarkup(<MarkdownRenderer text="[click me](javascript:alert(1)) and [payload](data:text/html,test)" />,