(sheetData)
| 439 | }; |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | return null; |
| 444 | } |
| 445 | |
| 446 | // Process sheet command and generate appropriate injection |
| 447 | async function processSheetCommand(sheetData) { |
| 448 | CarrotDebug.inject('processSheetCommand called with:', sheetData); |
| 449 | |
| 450 | const { type, entry } = sheetData; |
| 451 | |
| 452 | CarrotDebug.inject('Processing sheet command type:', type); |
| 453 | |
| 454 | CarrotDebug.inject('Processing sheet command', { |
| 455 | type: type, |
| 456 | entry: !!entry |
| 457 | }); |
| 458 | |
| 459 | // Create injection command |
| 460 | const settings = extension_settings[extensionName]; |
| 461 | |
| 462 | // Create simple, effective mandatory prompt without duplicating macro content |
| 463 | const sheetTypeMap = { |
| 464 | 'fullsheet': 'FULLSHEET', |
| 465 | 'tagsheet': 'TAGSHEET', |
| 466 | 'quicksheet': 'QUICKSHEET', |
| 467 | 'memsheet': 'MEMSHEET', |
| 468 | 'updatesheet': 'UPDATESHEET', |
| 469 | 'physheet': 'PHYSSHEET' |
| 470 | }; |
| 471 | |
| 472 | // Get the appropriate injection template |
| 473 | const templateCategoryMap = { |
| 474 | 'fullsheet': 'BunnyMo Fullsheet Injection', |
| 475 | 'tagsheet': 'BunnyMo Tagsheet Injection', |
| 476 | 'quicksheet': 'BunnyMo Quicksheet Injection', |
| 477 | 'memsheet': 'BunnyMo Memsheet Injection', |
| 478 | 'updatesheet': 'BunnyMo Updatesheet Injection', |
| 479 | 'physheet': 'BunnyMo Physsheet Injection' |
| 480 | }; |
| 481 | |
| 482 | const injectionTemplate = CarrotTemplateManager.getPrimaryTemplateForCategory(templateCategoryMap[type]); |
| 483 | |
| 484 | let injectionText; |
| 485 | let depth = 4; // Default depth |
| 486 | let role = 'system'; // Default role |
| 487 | |
| 488 | if (injectionTemplate) { |
| 489 | // Use custom template - no character name needed since ST handles the targeting |
| 490 | injectionText = injectionTemplate.content; |
| 491 | |
| 492 | // Use template-specific depth and role settings |
| 493 | // CRITICAL: Template depth property takes priority over legacy settings.inject_depth |
| 494 | depth = injectionTemplate.depth !== undefined ? injectionTemplate.depth : (injectionTemplate.settings?.inject_depth || 4); |
| 495 | role = injectionTemplate.role || 'system'; |
| 496 | |
| 497 | CarrotDebug.inject('Using template settings:', { |
| 498 | templateName: injectionTemplate.name, |
no test coverage detected