mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-29 18:46:59 +00:00
refactor: drop the shared subpath export, keeping package.json untouched
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.
This commit is contained in:
parent
ddd6b57938
commit
e682a9c0a7
5 changed files with 12 additions and 19 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue