mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-21 03:39:54 +00:00
8c78f533dd
Copilot caught an important runtime parity gap on PR #27489: the fix imported the npm `wrap-ansi` package directly, but Ink's `<Text wrap="wrap">` uses a runtime-selecting shim (`ui-tui/packages/hermes-ink/src/ink/wrapAnsi.ts`) that prefers `Bun.wrapAnsi` when running under Bun and falls back to the npm package elsewhere. So under Bun, Ink would render via `Bun.wrapAnsi` while `cursorLayout` would compute breaks via the npm package — any disagreement reintroduces the exact cursor-drift symptom the PR is meant to eliminate. Fix: - Export `wrapAnsi` from `@hermes/ink` (`packages/hermes-ink/src/entry-exports.ts` and `packages/hermes-ink/index.d.ts`) so the shim is the public surface. - Switch `ui-tui/src/lib/inputMetrics.ts` from `import wrapAnsi from 'wrap-ansi'` to `import { wrapAnsi } from '@hermes/ink'`. Both renderer (Ink) and cursor layout now traverse the same shim, so they share the runtime-selected implementation by construction. - Same swap in `textInputWrap.test.ts` and `cursorDriftRegression.test.ts` — tests now assert parity through the shim, which means under Bun they actually exercise Bun's implementation instead of asserting a tautology against the npm package. - Drop the direct `"wrap-ansi": "^9.0.0"` from `ui-tui/package.json`. `@hermes/ink` (which IS a declared dep) pulls wrap-ansi in transitively — that's not a phantom dep because the import path goes through `@hermes/ink`'s public exports, not through a hoisting accident. Verified: 791/791 vitest tests pass. `@hermes/ink` rebuilt (`dist/entry-exports.js` includes `wrapAnsi` export). TUI bundle rebuilt clean.
51 lines
1.5 KiB
JSON
51 lines
1.5 KiB
JSON
{
|
|
"name": "hermes-tui",
|
|
"version": "0.0.1",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "npm run build --prefix packages/hermes-ink && tsx --watch src/entry.tsx",
|
|
"start": "tsx src/entry.tsx",
|
|
"build": "node scripts/build.mjs",
|
|
"type-check": "tsc --noEmit -p tsconfig.json",
|
|
"lint": "eslint src/ packages/",
|
|
"lint:fix": "eslint src/ packages/ --fix",
|
|
"fmt": "prettier --write 'src/**/*.{ts,tsx}' 'packages/**/*.{ts,tsx}'",
|
|
"fix": "npm run lint:fix && npm run fmt",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest"
|
|
},
|
|
"dependencies": {
|
|
"@hermes/ink": "file:./packages/hermes-ink",
|
|
"@nanostores/react": "^1.1.0",
|
|
"ink": "^6.8.0",
|
|
"ink-text-input": "^6.0.0",
|
|
"nanostores": "^1.2.0",
|
|
"react": "^19.2.4",
|
|
"unicode-animations": "^1.0.3"
|
|
},
|
|
"devDependencies": {
|
|
"@babel/cli": "^7.28.6",
|
|
"@babel/core": "^7.29.0",
|
|
"@babel/plugin-syntax-jsx": "^7.28.6",
|
|
"@eslint/js": "^9",
|
|
"@types/node": "^25.5.0",
|
|
"@types/react": "^19.2.14",
|
|
"@typescript-eslint/eslint-plugin": "^8",
|
|
"@typescript-eslint/parser": "^8",
|
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
"esbuild": "~0.27.0",
|
|
"eslint": "^9",
|
|
"eslint-plugin-perfectionist": "^5",
|
|
"eslint-plugin-react": "^7",
|
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
"eslint-plugin-react-hooks": "^7",
|
|
"eslint-plugin-unused-imports": "^4",
|
|
"globals": "^16",
|
|
"prettier": "^3",
|
|
"tsx": "^4.19.0",
|
|
"typescript": "^5.7.0",
|
|
"vitest": "^4.1.3"
|
|
}
|
|
}
|