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