Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/coding-agent/src/core/agent-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1339,10 +1339,11 @@ export class AgentSession {
*
* @param content User message content (string or content array)
* @param options.deliverAs Delivery mode when streaming: "steer" or "followUp"
* @param options.allowCommands Allow trusted extension-injected slash commands to run
*/
async sendUserMessage(
content: string | (TextContent | ImageContent)[],
options?: { deliverAs?: "steer" | "followUp" },
options?: { deliverAs?: "steer" | "followUp"; allowCommands?: boolean },
): Promise<void> {
// Normalize content to text string + optional images
let text: string;
Expand All @@ -1364,9 +1365,10 @@ export class AgentSession {
if (images.length === 0) images = undefined;
}

// Use prompt() with expandPromptTemplates: false to skip command handling and template expansion
// Use prompt() with expandPromptTemplates: false by default to skip command handling and template expansion.
// Extensions may opt into command handling for trusted internal control messages.
await this.prompt(text, {
expandPromptTemplates: false,
expandPromptTemplates: options?.allowCommands === true,
streamingBehavior: options?.deliverAs,
images,
source: "extension",
Expand Down
4 changes: 2 additions & 2 deletions packages/coding-agent/src/core/extensions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export interface ReplacedSessionContext extends ExtensionCommandContext {

sendUserMessage(
content: string | (TextContent | ImageContent)[],
options?: { deliverAs?: "steer" | "followUp" },
options?: { deliverAs?: "steer" | "followUp"; allowCommands?: boolean },
): Promise<void>;
}

Expand Down Expand Up @@ -1223,7 +1223,7 @@ export interface ExtensionAPI {
*/
sendUserMessage(
content: string | (TextContent | ImageContent)[],
options?: { deliverAs?: "steer" | "followUp" },
options?: { deliverAs?: "steer" | "followUp"; allowCommands?: boolean },
): void;

/** Append a custom entry to the session for state persistence (not sent to LLM). */
Expand Down
Loading