hermes-agent/ui-tui/packages/hermes-ink/index.d.ts
xxxigm 18297899d7 fix(tui): drop ink-text-input re-export from @hermes/ink entry-exports (#31227)
The dashboard TUI bundle hung at startup with only 141 bytes of ANSI
reset sequences and a blank screen forever. Root cause: esbuild's
lightweight `__esm` helper at the top of `dist/entry.js` does not
await nested async init, so a circular async cycle in the module
graph never resolves. The cycle came from re-exporting
``TextInput`/`UncontrolledTextInput`` from `'ink-text-input'` here —
that npm package depends on the upstream `ink` package, whose graph
loops back through React + our in-tree `@hermes/ink` ink fork. The
result: `init_entry_exports` was emitted as `async … await
init_build4()` (where `build4` is `node_modules/ink-text-input/build`),
and the top-level `await Promise.all([init_entry_exports().then(...)])`
in `src/entry.tsx` deadlocked waiting on the dangling Promise.

Nobody in `ui-tui/` actually imports `TextInput` from `@hermes/ink` —
the composer uses the in-tree `src/components/textInput.tsx` widget
instead. Drop the re-export from the source so the bundle no longer
inlines the upstream ink graph at all. Callers that legitimately want
the upstream widget can still import it from the dedicated
`@hermes/ink/text-input` subpath, which sits outside `entry-exports`
and so does not get inlined into consumers' bundles.

After the fix:
* `dist/entry.js` shrinks from 2.9MB → 2.4MB (~11.5k fewer bundled
  lines) with zero `async __esm` wrappers remaining.
* `init_entry_exports` is now a synchronous `__esm` module.
* The bundle's top-level await chain resolves in ~30ms instead of
  hanging.
2026-07-01 02:10:32 -07:00

41 lines
2.7 KiB
TypeScript

/// <reference path="./ambient.d.ts" />
export { default as useStderr } from './src/hooks/use-stderr.ts'
export type { StderrHandle } from './src/hooks/use-stderr.ts'
export { default as useStdout } from './src/hooks/use-stdout.ts'
export type { StdoutHandle } from './src/hooks/use-stdout.ts'
export { Ansi } from './src/ink/Ansi.tsx'
export { evictInkCaches } from './src/ink/cache-eviction.ts'
export type { EvictLevel, InkCacheSizes } from './src/ink/cache-eviction.ts'
export { AlternateScreen } from './src/ink/components/AlternateScreen.tsx'
export { default as Box } from './src/ink/components/Box.tsx'
export type { Props as BoxProps } from './src/ink/components/Box.tsx'
export { default as Link } from './src/ink/components/Link.tsx'
export { default as Newline } from './src/ink/components/Newline.tsx'
export { NoSelect } from './src/ink/components/NoSelect.tsx'
export { RawAnsi } from './src/ink/components/RawAnsi.tsx'
export { default as ScrollBox } from './src/ink/components/ScrollBox.tsx'
export type { ScrollBoxHandle, ScrollBoxProps } from './src/ink/components/ScrollBox.tsx'
export { default as Spacer } from './src/ink/components/Spacer.tsx'
export type { Props as StdinProps } from './src/ink/components/StdinContext.ts'
export { default as Text } from './src/ink/components/Text.tsx'
export type { Props as TextProps } from './src/ink/components/Text.tsx'
export type { Key } from './src/ink/events/input-event.ts'
export { default as useApp } from './src/ink/hooks/use-app.ts'
export { useCursorAdvance } from './src/ink/hooks/use-cursor-advance.ts'
export { useDeclaredCursor } from './src/ink/hooks/use-declared-cursor.ts'
export { default as useInput } from './src/ink/hooks/use-input.ts'
export { useHasSelection, useSelection } from './src/ink/hooks/use-selection.ts'
export { default as useStdin } from './src/ink/hooks/use-stdin.ts'
export { useTabStatus } from './src/ink/hooks/use-tab-status.ts'
export { useTerminalFocus } from './src/ink/hooks/use-terminal-focus.ts'
export { useTerminalTitle } from './src/ink/hooks/use-terminal-title.ts'
export { useTerminalViewport } from './src/ink/hooks/use-terminal-viewport.ts'
export { default as measureElement } from './src/ink/measure-element.ts'
export { createRoot, forceRedraw, default as render, renderSync } from './src/ink/root.ts'
export type { Instance, RenderOptions, Root } from './src/ink/root.ts'
export { stringWidth } from './src/ink/stringWidth.ts'
export type { MouseTrackingMode } from './src/ink/termio/dec.ts'
export { wrapAnsi } from './src/ink/wrapAnsi.ts'
// 'ink-text-input' types deliberately not re-exported here; see
// src/entry-exports.ts for the full rationale (#31227). Use the
// '@hermes/ink/text-input' subpath when the upstream widget is needed.