Update files

This commit is contained in:
Mohamed Boudra
2026-02-07 12:58:06 +07:00
parent 6cfae77a71
commit b15691f13f
5 changed files with 29 additions and 6 deletions

View File

@@ -236,6 +236,11 @@ export type PersistedAgentDescriptor = {
export type AgentSessionConfig = {
provider: AgentProvider;
cwd: string;
/**
* Provider-agnostic system/developer instruction string.
* Mapped by each provider to its native instruction field.
*/
systemPrompt?: string;
modeId?: string;
model?: string;
thinkingOptionId?: string;

View File

@@ -896,6 +896,13 @@ class ClaudeAgentSession implements AgentSession {
// For "on" we omit maxThinkingTokens (SDK default max).
}
const appendedSystemPrompt = [
getOrchestratorModeInstructions(),
this.config.systemPrompt?.trim(),
]
.filter((entry): entry is string => typeof entry === "string" && entry.length > 0)
.join("\n\n");
const base: ClaudeOptions = {
cwd: this.config.cwd,
includePartialMessages: true,
@@ -904,11 +911,11 @@ class ClaudeAgentSession implements AgentSession {
canUseTool: this.handlePermissionRequest,
...(this.claudePath ? { pathToClaudeCodeExecutable: this.claudePath } : {}),
// Use Claude Code preset system prompt and load CLAUDE.md files
// Append orchestrator mode instructions for agents
// Append provider-agnostic system prompt and orchestrator instructions for agents.
systemPrompt: {
type: "preset",
preset: "claude_code",
append: [getOrchestratorModeInstructions()].filter(Boolean).join("\n"),
append: appendedSystemPrompt,
},
settingSources: ["user", "project"],
stderr: (data: string) => {

View File

@@ -1269,7 +1269,13 @@ class CodexAppServerAgentSession implements AgentSession {
const settings: Record<string, unknown> = {};
if (match.model) settings.model = match.model;
if (match.reasoning_effort) settings.reasoning_effort = match.reasoning_effort;
if (match.developer_instructions) settings.developer_instructions = match.developer_instructions;
const developerInstructions = [
match.developer_instructions?.trim(),
this.config.systemPrompt?.trim(),
]
.filter((entry): entry is string => typeof entry === "string" && entry.length > 0)
.join("\n\n");
if (developerInstructions) settings.developer_instructions = developerInstructions;
if (this.config.model) settings.model = this.config.model;
const thinkingOptionId = this.config.thinkingOptionId;
if (thinkingOptionId) settings.reasoning_effort = thinkingOptionId;
@@ -1714,6 +1720,9 @@ class CodexAppServerAgentSession implements AgentSession {
cwd: this.config.cwd ?? null,
approvalPolicy,
sandbox,
...(this.config.systemPrompt?.trim()
? { developerInstructions: this.config.systemPrompt.trim() }
: {}),
...(Object.keys(innerConfig).length > 0 ? { config: innerConfig } : {}),
})) as CodexThreadStartResponse;
const threadId = response?.thread?.id;

View File

@@ -2907,7 +2907,10 @@ function buildCodexMcpConfig(
}
const combinedDeveloperInstructions = [developerInstructions]
const combinedDeveloperInstructions = [
developerInstructions,
config.systemPrompt?.trim(),
]
.filter(Boolean)
.join("\n\n");

View File

@@ -4546,6 +4546,7 @@ export class Session {
const config: AgentSessionConfig = {
provider,
cwd,
systemPrompt: VOICE_AGENT_SYSTEM_INSTRUCTION,
modeId: this.voiceLlmModeId ?? "default",
...(model ? { model } : {}),
mcpServers: {
@@ -4632,8 +4633,6 @@ export class Session {
private buildVoiceAgentPrompt(userText: string): string {
const transcription = escapeXmlText(userText.trim());
return [
VOICE_AGENT_SYSTEM_INSTRUCTION,
"",
"<voice_transcription>",
transcription,
"</voice_transcription>",