





















@@ -62,10 +62,11 @@ import {
6262} from "../../bootstrap-budget.js";
6363import {
6464FULL_BOOTSTRAP_COMPLETED_CUSTOM_TYPE,
65+buildBootstrapContextForFiles,
6566hasCompletedBootstrapTurn,
6667isWorkspaceBootstrapPending,
6768makeBootstrapWarn,
68-resolveBootstrapContextForRun,
69+resolveBootstrapFilesForRun,
6970resolveContextInjectionMode,
7071} from "../../bootstrap-files.js";
7172import { createCacheTrace } from "../../cache-trace.js";
@@ -945,8 +946,26 @@ export async function runEmbeddedAttempt(
945946emitCorePluginToolStageSummary("core-plugin-tools", corePluginToolStages.snapshot());
946947const toolsEnabled = supportsModelTools(params.model);
947948const bootstrapHasFileAccess = toolsEnabled && toolsRaw.some((tool) => tool.name === "read");
949+const bootstrapWarn = makeBootstrapWarn({
950+ sessionLabel,
951+workspaceDir: resolvedWorkspace,
952+warn: (message) => log.warn(message),
953+});
954+const preloadedBootstrapFiles =
955+isRawModelRun || contextInjectionMode === "never"
956+ ? undefined
957+ : await resolveBootstrapFilesForRun({
958+workspaceDir: resolvedWorkspace,
959+config: params.config,
960+sessionKey: params.sessionKey,
961+sessionId: params.sessionId,
962+warn: bootstrapWarn,
963+contextMode: params.bootstrapContextMode,
964+runKind: params.bootstrapContextRunKind,
965+});
948966const bootstrapRouting = await resolveAttemptWorkspaceBootstrapRouting({
949967 isWorkspaceBootstrapPending,
968+bootstrapFiles: preloadedBootstrapFiles,
950969bootstrapContextRunKind: params.bootstrapContextRunKind,
951970trigger: params.trigger,
952971sessionKey: params.sessionKey,
@@ -970,20 +989,26 @@ export async function runEmbeddedAttempt(
970989 bootstrapMode,
971990sessionFile: params.sessionFile,
972991 hasCompletedBootstrapTurn,
973-resolveBootstrapContextForRun: async () =>
974-await resolveBootstrapContextForRun({
975-workspaceDir: resolvedWorkspace,
976-config: params.config,
977-sessionKey: params.sessionKey,
978-sessionId: params.sessionId,
979-warn: makeBootstrapWarn({
980- sessionLabel,
992+resolveBootstrapContextForRun: async () => {
993+const bootstrapFiles =
994+preloadedBootstrapFiles ??
995+(await resolveBootstrapFilesForRun({
981996workspaceDir: resolvedWorkspace,
982-warn: (message) => log.warn(message),
997+config: params.config,
998+sessionKey: params.sessionKey,
999+sessionId: params.sessionId,
1000+warn: bootstrapWarn,
1001+contextMode: params.bootstrapContextMode,
1002+runKind: params.bootstrapContextRunKind,
1003+}));
1004+return {
1005+ bootstrapFiles,
1006+contextFiles: buildBootstrapContextForFiles(bootstrapFiles, {
1007+config: params.config,
1008+warn: bootstrapWarn,
9831009}),
984-contextMode: params.bootstrapContextMode,
985-runKind: params.bootstrapContextRunKind,
986-}),
1010+};
1011+},
9871012});
9881013prepStages.mark("bootstrap-context");
9891014const remappedContextFiles = remapInjectedContextFilesToWorkspace({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。