refactor: move completion session/menu infrastructure from shell to dispatcher#2189
Open
refactor: move completion session/menu infrastructure from shell to dispatcher#2189
Conversation
…l + CLI to use them Agent-Logs-Url: https://github.com/microsoft/TypeAgent/sessions/8766b4b5-3498-4828-8c69-9f701f721f2a Co-authored-by: curtisman <12101885+curtisman@users.noreply.github.com>
…prove comment clarity Agent-Logs-Url: https://github.com/microsoft/TypeAgent/sessions/8766b4b5-3498-4828-8c69-9f701f721f2a Co-authored-by: curtisman <12101885+curtisman@users.noreply.github.com>
… wrappers - Rename debug namespace from typeagent:shell:partial to typeagent:completion:partial - Narrow barrel export in completion/index.ts (exclude TSTNode) - Clarify needQuotes comment in SearchMenuItem - Delete shell re-export files (partialCompletionSession.ts, prefixTree.ts, searchMenuBase.ts) - Update shell imports to use agent-dispatcher/helpers/completion directly - Move 8 PartialCompletionSession test suites to dispatcher package - Fix pre-existing TS2304 in electronTypes.ts (split export type into import + re-export) - Add moduleNameMapper for subdirectory tests in dispatcher jest config
…ammar dev dep from shell
- Use undefined instead of null for session/menu state in enhancedConsole - Extract repeated position callback into shared getPos const - Remove redundant render() calls after session.update() (menu callback handles it) - Add session.resetToIdle() on Enter path for consistency with Tab - Add CompletionSource<T> type alias for union parameter - Trim shell test helpers to minimal subset needed by switchMode tests - Make jest moduleNameMapper depth-agnostic for src/ imports - Add SearchMenuBase adapter unit tests
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
Moves the completion infrastructure (
PartialCompletionSession,SearchMenuBase, prefix treeTST, and related types) from the shell (Electron) package into dispatcher/helpers/completion, making it reusable by both the shell renderer and the CLI.Changes
Moved to dispatcher
PartialCompletionSession(formerlyshell/src/renderer/src/partialCompletionSession.ts→dispatcher/src/helpers/completion/session.ts)SearchMenuBase,normalizeMatchText,TST(formerlyshell/src/renderer/src/prefixTree.ts+searchMenuBase.ts→dispatcher/src/helpers/completion/searchMenu.ts)SearchMenuItem,SearchMenuPositionnow live in dispatcher and are re-exported by the shell'selectronTypes.tsNew CLI search menu
CliSearchMenu— terminal adapter forSearchMenuBasethat captures trie-filtered items for ghost-text rendering inenhancedConsole.tsSession-based completions in CLI
enhancedConsole.tsnow supports aPartialCompletionSession-driven mode alongside the legacy callback modesession.update()for proper grammar-aware, direction-sensitive completionsCompletionSource<T>union type accepts either a callback or anICompletionDispatcherSimplified callers
connect.tsandinteractive.tsremoved ~120 lines of duplicatedgetCompletionsData()logicTests moved
partialCompletionspec files moved fromshell/test/todispatcher/test/searchMenuBase.spec.tsvalidates the base adapter contractswitchMode.spec.tswith a slimmed helpermoduleNameMapperfor../src/→dist/resolutionCleanup
action-grammardev dependencyneedsSeparatorInAutoModere-export wrapper (session.ts imports directly)fix-dependabot-alerts.mjs