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