feat: Expose BuildSystemPromptOptions on before-agent-start event. (#3473)
Resolves: #3463
This commit is contained in:
@@ -76,7 +76,7 @@ import { CURRENT_SESSION_VERSION, getLatestCompactionEntry, type SessionHeader }
|
||||
import type { SettingsManager } from "./settings-manager.js";
|
||||
import type { SlashCommandInfo } from "./slash-commands.js";
|
||||
import { createSyntheticSourceInfo, type SourceInfo } from "./source-info.js";
|
||||
import { buildSystemPrompt } from "./system-prompt.js";
|
||||
import { type BuildSystemPromptOptions, buildSystemPrompt } from "./system-prompt.js";
|
||||
import { type BashOperations, createLocalBashOperations } from "./tools/bash.js";
|
||||
import { createAllToolDefinitions } from "./tools/index.js";
|
||||
import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
|
||||
@@ -300,6 +300,7 @@ export class AgentSession {
|
||||
|
||||
// Base system prompt (without extension appends) - used to apply fresh appends each turn
|
||||
private _baseSystemPrompt = "";
|
||||
private _baseSystemPromptOptions: BuildSystemPromptOptions = {};
|
||||
|
||||
constructor(config: AgentSessionConfig) {
|
||||
this.agent = config.agent;
|
||||
@@ -906,7 +907,7 @@ export class AgentSession {
|
||||
const loadedSkills = this._resourceLoader.getSkills().skills;
|
||||
const loadedContextFiles = this._resourceLoader.getAgentsFiles().agentsFiles;
|
||||
|
||||
return buildSystemPrompt({
|
||||
this._baseSystemPromptOptions = {
|
||||
cwd: this._cwd,
|
||||
skills: loadedSkills,
|
||||
contextFiles: loadedContextFiles,
|
||||
@@ -915,7 +916,8 @@ export class AgentSession {
|
||||
selectedTools: validToolNames,
|
||||
toolSnippets,
|
||||
promptGuidelines,
|
||||
});
|
||||
};
|
||||
return buildSystemPrompt(this._baseSystemPromptOptions);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -1048,6 +1050,7 @@ export class AgentSession {
|
||||
expandedText,
|
||||
currentImages,
|
||||
this._baseSystemPrompt,
|
||||
this._baseSystemPromptOptions,
|
||||
);
|
||||
// Add all custom messages from extensions
|
||||
if (result?.messages) {
|
||||
|
||||
Reference in New Issue
Block a user