Skip to content

[Bug]: hermes --tui fails to build on main — TS2322 in ops.ts /reload-mcp params #17773

@Heltman

Description

@Heltman

Summary

On main (current HEAD 828d3a320, after 4d7fc0f37), hermes --tui fails to build out of the box with a TypeScript error. First invocation on a fresh install dies during the auto-build step:

❯ hermes --tui
Installing TUI dependencies…
TUI build failed.
> [email protected] build
> npm run build --prefix packages/hermes-ink && tsc -p tsconfig.build.json && npm run build:compile && chmod +x dist/entry.js

> @hermes/[email protected] build
> esbuild src/entry-exports.ts --bundle --platform=node --format=esm --packages=external --outfile=dist/ink-bundle.js

src/app/slash/commands/ops.ts(86,9): error TS2322: Type 'string | null' is not assignable to type 'string'.
  Type 'null' is not assignable to type 'string'.

  dist/ink-bundle.js  416.8kb

⚡ Done in 21ms

dist/entry.js is never produced → subsequent hermes --tui attempts re-run npm run build and fail the same way. TUI is effectively unusable on current main.

Environment

  • hermes-agent main @ 828d3a3 (PR context)
  • macOS 14, Node v22.22.2, npm 11.6.4
  • Clean node_modules (post npm install)

Root cause

ui-tui/src/app/slash/commands/ops.ts (introduced in 4d7fc0f):

const params: { session_id: string; confirm?: boolean; always?: boolean } = {
  session_id: ctx.sid
}

But in ui-tui/src/app/slash/types.ts:

sid: null | string

Every other slash command that forwards ctx.sidprompt.background, config.set, session.compress, session.branch, image.attach in session.ts — just passes it through without type-narrowing; the gateway already handles a null session_id. ops.ts is the outlier that declares the narrower string, so strict TS rejects the assignment.

Fix

Widen the param type to string | null to match the rest of the codebase and the actual ctx.sid type. PR: #NNN (replace with link).

Regression

Introduced in 4d7fc0f37feat(gateway,cli): confirm /reload-mcp to warn about prompt cache invalidation.

Probably slipped through because the TUI dev loop (npm run devtsx --watch) doesn't run tsc -p tsconfig.build.json, so the stricter build-time typecheck never fires until end users hit hermes --tui's on-demand build path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/tuiTerminal UI (ui-tui/ + tui_gateway/)type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions