(
prompt: string | ContentBlockParam[],
options?: { uuid?: string; isMeta?: boolean },
)
| 226 | } |
| 227 | |
| 228 | async *submitMessage( |
| 229 | prompt: string | ContentBlockParam[], |
| 230 | options?: { uuid?: string; isMeta?: boolean }, |
| 231 | ): AsyncGenerator<SDKMessage, void, unknown> { |
| 232 | const { |
| 233 | cwd, |
| 234 | commands, |
| 235 | tools, |
| 236 | mcpClients, |
| 237 | verbose = false, |
| 238 | thinkingConfig, |
| 239 | maxTurns, |
| 240 | maxBudgetUsd, |
| 241 | taskBudget, |
| 242 | canUseTool, |
| 243 | customSystemPrompt, |
| 244 | appendSystemPrompt, |
| 245 | userSpecifiedModel, |
| 246 | fallbackModel, |
| 247 | jsonSchema, |
| 248 | getAppState, |
| 249 | setAppState, |
| 250 | replayUserMessages = false, |
| 251 | includePartialMessages = false, |
| 252 | agents = [], |
| 253 | setSDKStatus, |
| 254 | orphanedPermission, |
| 255 | } = this.config |
| 256 | |
| 257 | this.discoveredSkillNames.clear() |
| 258 | setCwd(cwd) |
| 259 | const persistSession = !isSessionPersistenceDisabled() |
| 260 | const startTime = Date.now() |
| 261 | |
| 262 | // Wrap canUseTool to track permission denials |
| 263 | const wrappedCanUseTool: CanUseToolFn = async ( |
| 264 | tool, |
| 265 | input, |
| 266 | toolUseContext, |
| 267 | assistantMessage, |
| 268 | toolUseID, |
| 269 | forceDecision, |
| 270 | ) => { |
| 271 | const result = await canUseTool( |
| 272 | tool, |
| 273 | input, |
| 274 | toolUseContext, |
| 275 | assistantMessage, |
| 276 | toolUseID, |
| 277 | forceDecision, |
| 278 | ) |
| 279 | |
| 280 | // Track denials for SDK reporting |
| 281 | if (result.behavior !== 'allow') { |
| 282 | this.permissionDenials.push({ |
| 283 | tool_name: sdkCompatToolName(tool.name), |
| 284 | tool_use_id: toolUseID, |
| 285 | tool_input: input, |
no test coverage detected