refactor(desktop): decompose use-prompt-actions (slash + submit sub-hooks) - #55504
Merged
Conversation
…lash The usePromptActions body's largest unit was executeSlashCommand — a ~530-line `/command` dispatcher. Lift it into a colocated useSlashCommand sub-hook (use-prompt-actions/slash.ts): the ~13 values it closed over become a typed SlashCommandDeps object the parent passes in; the dispatcher body (and its inner runSlash recursion) moves verbatim. SlashActionCtx (slash-only) moves with it. Pure restructuring, no behaviour change (verified: full use-prompt-actions test suite still green). index.ts: 1,772 -> ~1,250.
…bmit After the slash dispatcher, the next-largest body unit was submitPromptText — a ~280-line submit pipeline. Lift it into a colocated useSubmitPrompt sub-hook (use-prompt-actions/submit.ts) with a typed SubmitPromptDeps object; body moves verbatim. SubmitTextOptions moves to utils.ts (shared by submit + submitText). Pure restructuring, no behaviour change (full use-prompt-actions suite green). index.ts: 1,212 -> 937.
Collaborator
Author
|
Extended: also lifted the ~280-line |
1 task
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…lit-prompt-body refactor(desktop): decompose use-prompt-actions (slash + submit sub-hooks)
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…lit-prompt-body refactor(desktop): decompose use-prompt-actions (slash + submit sub-hooks)
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…lit-prompt-body refactor(desktop): decompose use-prompt-actions (slash + submit sub-hooks)
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…lit-prompt-body refactor(desktop): decompose use-prompt-actions (slash + submit sub-hooks)
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…lit-prompt-body refactor(desktop): decompose use-prompt-actions (slash + submit sub-hooks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
God-hook split #3 of 3 — and the deepest.
usePromptActions' standalone helpers already shipped (#55459) + foldered (#55493), so what remained was the stateful body. Its single biggest unit isexecuteSlashCommand: a ~530-line/commanddispatcher (with a recursive innerrunSlash).This lifts it into a colocated
useSlashCommandsub-hook (use-prompt-actions/slash.ts). The ~13 values it closed over become a typedSlashCommandDepsobject the parent passes in; the dispatcher body (and its innerrunSlashrecursion + nested handlers) moves verbatim. The slash-onlySlashActionCtxtype moves with it.index.ts: 1,772 → 1,212 lines (slash.tsis 614).Notes
tscverifies every reference is threaded (a missing dep = a compile error).use-prompt-actionstest suite (51 tests) still passes, including the realusePromptActionshook test that drives slash commands.usePromptActionskeeps its other callbacks (submit/retry, attachment upload, restore/edit, steer, cancel) and now doesconst executeSlashCommand = useSlashCommand({ … }).Test plan
npm run typecheck— 0 errorseslinton the folder — cleanvitest runuse-prompt-actions — 51 pass/help,/model,/skin, a skill command, an alias (e.g. recursive dispatch),/undoprefill, an exec command that renders inline output