refactor(ai): move Ask AI domain logic out of the provider adapter - #666
Open
Reversean wants to merge 1 commit into
Open
refactor(ai): move Ask AI domain logic out of the provider adapter#666Reversean wants to merge 1 commit into
Reversean wants to merge 1 commit into
Conversation
This was referenced Jul 29, 2026
Reversean
force-pushed
the
refactor/ai-service-layering
branch
from
July 29, 2026 17:21
71629b8 to
16fd7a6
Compare
neSpecc
approved these changes
Jul 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the “Ask AI” feature by moving prompt/instruction assembly out of the Vercel AI integration adapter and into a dedicated domain area under src/services/askAi/, leaving src/integrations/vercel-ai/ as a thin transport layer.
Changes:
- Moved Ask AI domain prompt/instruction modules into
src/services/askAi/and updatedAIService.generateSuggestionto assemble{ system, prompt }there. - Simplified the Vercel adapter API to
complete({ system, prompt }): Promise<string>and added unit coverage for it. - Added unit tests to validate
AIService.generateSuggestionorchestration and the Vercel transport behavior; bumped package version.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/services/ai.ts |
Moves orchestration into AIService and calls the adapter via complete({ system, prompt }). |
src/integrations/vercel-ai/index.ts |
Refactors the adapter to a transport-style complete method that forwards to generateText. |
src/services/askAi/instructions/cto.ts |
Adds the CTO system instruction in the new domain location. |
src/services/askAi/inputs/eventSolving.ts |
Adds event prompt serialization in the new domain location. |
test/services/askAi.test.ts |
Adds unit tests asserting AIService.generateSuggestion calls the transport with the assembled system/prompt. |
test/integrations/vercel-ai.test.ts |
Adds unit tests asserting adapter forwards to generateText and returns text. |
package.json |
Bumps version to 1.5.10. |
Comments suppressed due to low confidence (1)
src/integrations/vercel-ai/index.ts:39
- Continuation of the indentation issue: this docblock/method body is indented differently from the surrounding codebase (2-space blocks). Reformatting here will keep the file consistent and avoid noisy diffs from auto-formatting.
* Send a system/prompt pair to the model and return the generated text
*
* @param {CompletionParams} params - system instruction and prompt to complete
* @returns {Promise<string>} text generated by the model
* @todo add defence against invalid prompt injection
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Dobrunia
approved these changes
Jul 30, 2026
Reversean
force-pushed
the
refactor/ai-service-layering
branch
from
August 16, 2026 15:02
6a67733 to
9ba6bdd
Compare
The Ask AI prompt assembly, the model instruction and the event serialisation live in src/integrations/vercel-ai/ although none of them import anything from the provider. Replacing the provider drags the domain with it, and anything applied around the model call can only be reused by importing from another adapter's internals. Move those modules to src/services/askAi/ and reduce VercelAIApi to a transport taking a system/prompt pair. The service moves with them and is renamed to AskAiService, which is why src/resolvers/event.js changes too.
Reversean
force-pushed
the
refactor/ai-service-layering
branch
from
August 17, 2026 18:41
9ba6bdd to
e9f6570
Compare
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.
src/integrations/holds adapters to external services, but the Ask AI prompt assembly, the model instruction and the event serialisation live inside the Vercel adapter without importing anything from the provider. Replacing the provider drags the domain with it, and anything applied around the model call can only be reused by importing from another adapter's internals.The domain modules move to
src/services/askAi/andVercelAIApiis reduced to a transport:instructions/cto.tsandinputs/eventSolving.tsmove unchanged. The service is renamedAIService→AskAiServiceto match the package, so its callersrc/resolvers/event.jschanges with it.No behaviour change:
generateSuggestionkeeps its signature.