(
prompt: string | ContentBlockParam[],
options?: { uuid?: string; isMeta?: boolean },
)
| 207 | } |
| 208 | |
| 209 | async *submitMessage( |
| 210 | prompt: string | ContentBlockParam[], |
| 211 | options?: { uuid?: string; isMeta?: boolean }, |
| 212 | ): AsyncGenerator<SDKMessage, void, unknown> { |
| 213 | const { |
| 214 | cwd, |
| 215 | commands, |
| 216 | tools, |
| 217 | mcpClients, |
| 218 | verbose = false, |
| 219 | thinkingConfig, |
| 220 | maxTurns, |
| 221 | maxBudgetUsd, |
| 222 | taskBudget, |
| 223 | canUseTool, |
| 224 | customSystemPrompt, |
| 225 | appendSystemPrompt, |
| 226 | userSpecifiedModel, |
| 227 | fallbackModel, |
| 228 | jsonSchema, |
| 229 | getAppState, |
| 230 | setAppState, |
| 231 | replayUserMessages = false, |
| 232 | includePartialMessages = false, |
| 233 | agents = [], |
| 234 | setSDKStatus, |
| 235 | orphanedPermission, |
| 236 | } = this.config |
| 237 | |
| 238 | this.discoveredSkillNames.clear() |
| 239 | setCwd(cwd) |
| 240 | const persistSession = !isSessionPersistenceDisabled() |
| 241 | const startTime = Date.now() |
| 242 | |
| 243 | // Wrap canUseTool to track permission denials |
| 244 | const wrappedCanUseTool: CanUseToolFn = async ( |
| 245 | tool, |
| 246 | input, |
| 247 | toolUseContext, |
| 248 | assistantMessage, |
| 249 | toolUseID, |
| 250 | forceDecision, |
| 251 | ) => { |
| 252 | const result = await canUseTool( |
| 253 | tool, |
| 254 | input, |
| 255 | toolUseContext, |
| 256 | assistantMessage, |
| 257 | toolUseID, |
| 258 | forceDecision, |
| 259 | ) |
| 260 | |
| 261 | // Track denials for SDK reporting |
| 262 | if (result.behavior !== 'allow') { |
| 263 | this.permissionDenials.push({ |
| 264 | tool_name: sdkCompatToolName(tool.name), |
| 265 | tool_use_id: toolUseID, |
| 266 | tool_input: input, |
no test coverage detected