Handle mentioned apps via smart context (#1412)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Send mentioned apps (names + files) to the engine through
dyad_options, omit inline other-apps prefix when engine is enabled, and
adjust e2e to snapshot request payload.
>
> - **Engine/Backend**:
> - Pass mentioned apps to engine via
`providerOptions['dyad-engine'].dyadMentionedApps` and forward as
`dyad_options.mentioned_apps` in `llm_engine_provider`.
> - Gate inline other-apps context: only include `otherCodebasePrefix`
when `isEngineEnabled` is false.
> - Enhance `extractMentionedAppsCodebases` to return `files` alongside
`codebaseInfo`.
> - **Tests**:
> - e2e: change `mention app (with pro)` snapshot to
`snapshotServerDump("request")` and update snapshot to assert request
payload contents.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7ddddf6c16c53cd36b4c7e4ec6a57da0616d1bb0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { db } from "../../db";
|
||||
import { getDyadAppPath } from "../../paths/paths";
|
||||
import { extractCodebase } from "../../utils/codebase";
|
||||
import { CodebaseFile, extractCodebase } from "../../utils/codebase";
|
||||
import { validateChatContext } from "../utils/context_paths_utils";
|
||||
import log from "electron-log";
|
||||
|
||||
@@ -10,7 +10,7 @@ const logger = log.scope("mention_apps");
|
||||
export async function extractMentionedAppsCodebases(
|
||||
mentionedAppNames: string[],
|
||||
excludeCurrentAppId?: number,
|
||||
): Promise<{ appName: string; codebaseInfo: string }[]> {
|
||||
): Promise<{ appName: string; codebaseInfo: string; files: CodebaseFile[] }[]> {
|
||||
if (mentionedAppNames.length === 0) {
|
||||
return [];
|
||||
}
|
||||
@@ -25,14 +25,18 @@ export async function extractMentionedAppsCodebases(
|
||||
) && app.id !== excludeCurrentAppId,
|
||||
);
|
||||
|
||||
const results: { appName: string; codebaseInfo: string }[] = [];
|
||||
const results: {
|
||||
appName: string;
|
||||
codebaseInfo: string;
|
||||
files: CodebaseFile[];
|
||||
}[] = [];
|
||||
|
||||
for (const app of mentionedApps) {
|
||||
try {
|
||||
const appPath = getDyadAppPath(app.path);
|
||||
const chatContext = validateChatContext(app.chatContext);
|
||||
|
||||
const { formattedOutput } = await extractCodebase({
|
||||
const { formattedOutput, files } = await extractCodebase({
|
||||
appPath,
|
||||
chatContext,
|
||||
});
|
||||
@@ -40,6 +44,7 @@ export async function extractMentionedAppsCodebases(
|
||||
results.push({
|
||||
appName: app.name,
|
||||
codebaseInfo: formattedOutput,
|
||||
files,
|
||||
});
|
||||
|
||||
logger.log(`Extracted codebase for mentioned app: ${app.name}`);
|
||||
|
||||
Reference in New Issue
Block a user