(input, _context)
| 651 | }, |
| 652 | |
| 653 | async validateInput(input, _context) { |
| 654 | if (input.to.trim().length === 0) { |
| 655 | return { |
| 656 | result: false, |
| 657 | message: 'to must not be empty', |
| 658 | errorCode: 9, |
| 659 | } |
| 660 | } |
| 661 | const addr = parseAddress(input.to) |
| 662 | if ( |
| 663 | (addr.scheme === 'bridge' || addr.scheme === 'uds') && |
| 664 | addr.target.trim().length === 0 |
| 665 | ) { |
| 666 | return { |
| 667 | result: false, |
| 668 | message: 'address target must not be empty', |
| 669 | errorCode: 9, |
| 670 | } |
| 671 | } |
| 672 | if (input.to.includes('@')) { |
| 673 | return { |
| 674 | result: false, |
| 675 | message: |
| 676 | 'to must be a bare teammate name or "*" — there is only one team per session', |
| 677 | errorCode: 9, |
| 678 | } |
| 679 | } |
| 680 | if (feature('UDS_INBOX') && parseAddress(input.to).scheme === 'bridge') { |
| 681 | // Structured-message rejection first — it's the permanent constraint. |
| 682 | // Showing "not connected" first would make the user reconnect only to |
| 683 | // hit this error on retry. |
| 684 | if (typeof input.message !== 'string') { |
| 685 | return { |
| 686 | result: false, |
| 687 | message: |
| 688 | 'structured messages cannot be sent cross-session — only plain text', |
| 689 | errorCode: 9, |
| 690 | } |
| 691 | } |
| 692 | // postInterClaudeMessage derives from= via getReplBridgeHandle() — |
| 693 | // check handle directly for the init-timing window. Also check |
| 694 | // isReplBridgeActive() to reject outbound-only (CCR mirror) mode |
| 695 | // where the bridge is write-only and peer messaging is unsupported. |
| 696 | if (!getReplBridgeHandle() || !isReplBridgeActive()) { |
| 697 | return { |
| 698 | result: false, |
| 699 | message: |
| 700 | 'Remote Control is not connected — cannot send to a bridge: target. Reconnect with /remote-control first.', |
| 701 | errorCode: 9, |
| 702 | } |
| 703 | } |
| 704 | return { result: true } |
| 705 | } |
| 706 | if ( |
| 707 | feature('UDS_INBOX') && |
| 708 | parseAddress(input.to).scheme === 'uds' && |
| 709 | typeof input.message === 'string' |
| 710 | ) { |
nothing calls this directly
no test coverage detected