From e682a9c0a749fc85e772115abf42b9bfa6a585ec Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Tue, 28 Jul 2026 03:54:49 -0500 Subject: [PATCH] refactor: drop the shared subpath export, keeping package.json untouched MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The subpath entry existed only so the TUI could import the client-side projection fallback. The TUI spawns its gateway from this same checkout and cannot version-skew with it, so that fallback was dead weight — it reads `display` directly now. With its last caller gone the dispatch helper folds back into the desktop, where an older backend is genuinely reachable. apps/shared/package.json is byte-identical to main again. --- .../src/app/session/hooks/use-prompt-actions/slash.ts | 8 +++++--- apps/shared/package.json | 1 - apps/shared/src/index.ts | 2 +- apps/shared/src/skill-scaffold.ts | 9 --------- ui-tui/src/app/createSlashHandler.ts | 11 ++++++----- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts index 5bfccf1be7a0..ccbdac0c4086 100644 --- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts +++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts @@ -1,6 +1,6 @@ import { type MutableRefObject, useCallback, useRef } from 'react' -import { dispatchDisplayText } from '@hermes/shared' +import { skillInvocationText } from '@hermes/shared' import { getProfiles } from '@/hermes' import type { Translations } from '@/i18n' @@ -268,8 +268,10 @@ export function useSlashCommand(deps: SlashCommandDeps) { // A skill/bundle dispatch's `message` is the expanded skill body — // model-facing scaffolding. Never render it; the bubble shows the - // invocation instead. - const displayText = dispatchDisplayText('display' in dispatch ? dispatch.display : undefined, message) + // invocation the gateway projected, or one read from the payload + // when the backend is older than this app. + const projected = 'display' in dispatch ? dispatch.display?.trim() : '' + const displayText = projected || skillInvocationText(message) || undefined // Gate on the TARGET session's own busy state, not the foreground // view's — see isTargetSessionBusy. `busyRef` mirrors whatever chat diff --git a/apps/shared/package.json b/apps/shared/package.json index e3482d8a466a..2a2f46ef73d5 100644 --- a/apps/shared/package.json +++ b/apps/shared/package.json @@ -8,7 +8,6 @@ "./billing": "./src/billing-types.ts", "./billing-policy": "./src/billing-policy.ts", "./charge-settlement": "./src/charge-settlement.ts", - "./skill-scaffold": "./src/skill-scaffold.ts", "./skin": "./src/skin.ts" }, "types": "./src/index.ts", diff --git a/apps/shared/src/index.ts b/apps/shared/src/index.ts index 2339c97716fd..391a3715bd20 100644 --- a/apps/shared/src/index.ts +++ b/apps/shared/src/index.ts @@ -44,7 +44,7 @@ export { JsonRpcGatewayClient, type WebSocketLike } from './json-rpc-gateway' -export { dispatchDisplayText, skillInvocationText } from './skill-scaffold' +export { skillInvocationText } from './skill-scaffold' export { type HermesSkin, SKIN_BRANDING_TOKENS, diff --git a/apps/shared/src/skill-scaffold.ts b/apps/shared/src/skill-scaffold.ts index a06ce3d567a2..fffae405b2a6 100644 --- a/apps/shared/src/skill-scaffold.ts +++ b/apps/shared/src/skill-scaffold.ts @@ -67,12 +67,3 @@ export function skillInvocationText(text: string): null | string { return instruction ? `${label} ${instruction.replace(/\s+/g, ' ')}` : label } - -/** - * What a skill/bundle dispatch should render as. Prefers the gateway's own - * projection; falls back to reading the payload for an older gateway that - * doesn't send one. Undefined for an ordinary send, which renders as written. - */ -export function dispatchDisplayText(display: string | undefined, message: string): string | undefined { - return display?.trim() || skillInvocationText(message) || undefined -} diff --git a/ui-tui/src/app/createSlashHandler.ts b/ui-tui/src/app/createSlashHandler.ts index 9a50f77b6171..f0d38257e263 100644 --- a/ui-tui/src/app/createSlashHandler.ts +++ b/ui-tui/src/app/createSlashHandler.ts @@ -1,5 +1,3 @@ -import { dispatchDisplayText } from '@hermes/shared/skill-scaffold' - import { parseSlashCommand } from '../domain/slash.js' import type { SlashExecResponse } from '../gatewayTypes.js' import { asCommandDispatch, rpcErrorMessage } from '../lib/rpc.js' @@ -107,10 +105,13 @@ export function createSlashHandler(ctx: SlashHandlerContext): (cmd: string) => b } // A skill/bundle dispatch's `message` is the expanded skill body — - // model-facing scaffolding. The transcript shows the invocation instead; - // an ordinary send has no projection and goes through unchanged. + // model-facing scaffolding. `display` is the invocation the gateway + // projected; the transcript shows that instead. An ordinary send has no + // projection and goes through unchanged. No client-side fallback here: + // the TUI spawns its gateway from this same checkout, so the two can't + // version-skew (unlike the desktop, which can meet an older backend). const sendDispatch = (display: string | undefined, message: string) => { - const shown = dispatchDisplayText(display, message) + const shown = display?.trim() return shown ? send(message, true, shown) : send(message) }