Update files
This commit is contained in:
@@ -236,6 +236,11 @@ export type PersistedAgentDescriptor = {
|
|||||||
export type AgentSessionConfig = {
|
export type AgentSessionConfig = {
|
||||||
provider: AgentProvider;
|
provider: AgentProvider;
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
/**
|
||||||
|
* Provider-agnostic system/developer instruction string.
|
||||||
|
* Mapped by each provider to its native instruction field.
|
||||||
|
*/
|
||||||
|
systemPrompt?: string;
|
||||||
modeId?: string;
|
modeId?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
thinkingOptionId?: string;
|
thinkingOptionId?: string;
|
||||||
|
|||||||
@@ -896,6 +896,13 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
// For "on" we omit maxThinkingTokens (SDK default max).
|
// 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 = {
|
const base: ClaudeOptions = {
|
||||||
cwd: this.config.cwd,
|
cwd: this.config.cwd,
|
||||||
includePartialMessages: true,
|
includePartialMessages: true,
|
||||||
@@ -904,11 +911,11 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
canUseTool: this.handlePermissionRequest,
|
canUseTool: this.handlePermissionRequest,
|
||||||
...(this.claudePath ? { pathToClaudeCodeExecutable: this.claudePath } : {}),
|
...(this.claudePath ? { pathToClaudeCodeExecutable: this.claudePath } : {}),
|
||||||
// Use Claude Code preset system prompt and load CLAUDE.md files
|
// 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: {
|
systemPrompt: {
|
||||||
type: "preset",
|
type: "preset",
|
||||||
preset: "claude_code",
|
preset: "claude_code",
|
||||||
append: [getOrchestratorModeInstructions()].filter(Boolean).join("\n"),
|
append: appendedSystemPrompt,
|
||||||
},
|
},
|
||||||
settingSources: ["user", "project"],
|
settingSources: ["user", "project"],
|
||||||
stderr: (data: string) => {
|
stderr: (data: string) => {
|
||||||
|
|||||||
@@ -1269,7 +1269,13 @@ class CodexAppServerAgentSession implements AgentSession {
|
|||||||
const settings: Record<string, unknown> = {};
|
const settings: Record<string, unknown> = {};
|
||||||
if (match.model) settings.model = match.model;
|
if (match.model) settings.model = match.model;
|
||||||
if (match.reasoning_effort) settings.reasoning_effort = match.reasoning_effort;
|
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;
|
if (this.config.model) settings.model = this.config.model;
|
||||||
const thinkingOptionId = this.config.thinkingOptionId;
|
const thinkingOptionId = this.config.thinkingOptionId;
|
||||||
if (thinkingOptionId) settings.reasoning_effort = thinkingOptionId;
|
if (thinkingOptionId) settings.reasoning_effort = thinkingOptionId;
|
||||||
@@ -1714,6 +1720,9 @@ class CodexAppServerAgentSession implements AgentSession {
|
|||||||
cwd: this.config.cwd ?? null,
|
cwd: this.config.cwd ?? null,
|
||||||
approvalPolicy,
|
approvalPolicy,
|
||||||
sandbox,
|
sandbox,
|
||||||
|
...(this.config.systemPrompt?.trim()
|
||||||
|
? { developerInstructions: this.config.systemPrompt.trim() }
|
||||||
|
: {}),
|
||||||
...(Object.keys(innerConfig).length > 0 ? { config: innerConfig } : {}),
|
...(Object.keys(innerConfig).length > 0 ? { config: innerConfig } : {}),
|
||||||
})) as CodexThreadStartResponse;
|
})) as CodexThreadStartResponse;
|
||||||
const threadId = response?.thread?.id;
|
const threadId = response?.thread?.id;
|
||||||
|
|||||||
@@ -2907,7 +2907,10 @@ function buildCodexMcpConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const combinedDeveloperInstructions = [developerInstructions]
|
const combinedDeveloperInstructions = [
|
||||||
|
developerInstructions,
|
||||||
|
config.systemPrompt?.trim(),
|
||||||
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join("\n\n");
|
.join("\n\n");
|
||||||
|
|
||||||
|
|||||||
@@ -4546,6 +4546,7 @@ export class Session {
|
|||||||
const config: AgentSessionConfig = {
|
const config: AgentSessionConfig = {
|
||||||
provider,
|
provider,
|
||||||
cwd,
|
cwd,
|
||||||
|
systemPrompt: VOICE_AGENT_SYSTEM_INSTRUCTION,
|
||||||
modeId: this.voiceLlmModeId ?? "default",
|
modeId: this.voiceLlmModeId ?? "default",
|
||||||
...(model ? { model } : {}),
|
...(model ? { model } : {}),
|
||||||
mcpServers: {
|
mcpServers: {
|
||||||
@@ -4632,8 +4633,6 @@ export class Session {
|
|||||||
private buildVoiceAgentPrompt(userText: string): string {
|
private buildVoiceAgentPrompt(userText: string): string {
|
||||||
const transcription = escapeXmlText(userText.trim());
|
const transcription = escapeXmlText(userText.trim());
|
||||||
return [
|
return [
|
||||||
VOICE_AGENT_SYSTEM_INSTRUCTION,
|
|
||||||
"",
|
|
||||||
"<voice_transcription>",
|
"<voice_transcription>",
|
||||||
transcription,
|
transcription,
|
||||||
"</voice_transcription>",
|
"</voice_transcription>",
|
||||||
|
|||||||
Reference in New Issue
Block a user