(input, _context)
| 602 | }, |
| 603 | |
| 604 | async validateInput(input, _context) { |
| 605 | if (input.to.trim().length === 0) { |
| 606 | return { |
| 607 | result: false, |
| 608 | message: 'to must not be empty', |
| 609 | errorCode: 9, |
| 610 | } |
| 611 | } |
| 612 | const addr = parseAddress(input.to) |
| 613 | if ( |
| 614 | (addr.scheme === 'bridge' || addr.scheme === 'uds') && |
| 615 | addr.target.trim().length === 0 |
| 616 | ) { |
| 617 | return { |
| 618 | result: false, |
| 619 | message: 'address target must not be empty', |
| 620 | errorCode: 9, |
| 621 | } |
| 622 | } |
| 623 | if (input.to.includes('@')) { |
| 624 | return { |
| 625 | result: false, |
| 626 | message: |
| 627 | 'to must be a bare teammate name or "*" — there is only one team per session', |
| 628 | errorCode: 9, |
| 629 | } |
| 630 | } |
| 631 | if (feature('UDS_INBOX') && parseAddress(input.to).scheme === 'bridge') { |
| 632 | // Structured-message rejection first — it's the permanent constraint. |
| 633 | // Showing "not connected" first would make the user reconnect only to |
| 634 | // hit this error on retry. |
| 635 | if (typeof input.message !== 'string') { |
| 636 | return { |
| 637 | result: false, |
| 638 | message: |
| 639 | 'structured messages cannot be sent cross-session — only plain text', |
| 640 | errorCode: 9, |
| 641 | } |
| 642 | } |
| 643 | // postInterClaudeMessage derives from= via getReplBridgeHandle() — |
| 644 | // check handle directly for the init-timing window. Also check |
| 645 | // isReplBridgeActive() to reject outbound-only (CCR mirror) mode |
| 646 | // where the bridge is write-only and peer messaging is unsupported. |
| 647 | if (!getReplBridgeHandle() || !isReplBridgeActive()) { |
| 648 | return { |
| 649 | result: false, |
| 650 | message: |
| 651 | 'Remote Control is not connected — cannot send to a bridge: target. Reconnect with /remote-control first.', |
| 652 | errorCode: 9, |
| 653 | } |
| 654 | } |
| 655 | return { result: true } |
| 656 | } |
| 657 | if ( |
| 658 | feature('UDS_INBOX') && |
| 659 | parseAddress(input.to).scheme === 'uds' && |
| 660 | typeof input.message === 'string' |
| 661 | ) { |
nothing calls this directly
no test coverage detected