MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / call

Function call

source code/tools/SendMessageTool/SendMessageTool.ts:743–915  ·  view source on GitHub ↗
(input, context, canUseTool, assistantMessage)

Source from the content-addressed store, hash-verified

741 },
742
743 async call(input, context, canUseTool, assistantMessage) {
744 if (feature('UDS_INBOX') && typeof input.message === 'string') {
745 const addr = parseAddress(input.to)
746 if (addr.scheme === 'bridge') {
747 // Re-check handle — checkPermissions blocks on user approval (can be
748 // minutes). validateInput's check is stale if the bridge dropped
749 // during the prompt wait; without this, from="unknown" ships.
750 // Also re-check isReplBridgeActive for outbound-only mode.
751 if (!getReplBridgeHandle() || !isReplBridgeActive()) {
752 return {
753 data: {
754 success: false,
755 message: `Remote Control disconnected before send — cannot deliver to ${input.to}`,
756 },
757 }
758 }
759 /* eslint-disable @typescript-eslint/no-require-imports */
760 const { postInterClaudeMessage } =
761 require('../../bridge/peerSessions.js') as typeof import('../../bridge/peerSessions.js')
762 /* eslint-enable @typescript-eslint/no-require-imports */
763 const result = await postInterClaudeMessage(
764 addr.target,
765 input.message,
766 )
767 const preview = input.summary || truncate(input.message, 50)
768 return {
769 data: {
770 success: result.ok,
771 message: result.ok
772 ? `“${preview}” → ${input.to}`
773 : `Failed to send to ${input.to}: ${result.error ?? 'unknown'}`,
774 },
775 }
776 }
777 if (addr.scheme === 'uds') {
778 /* eslint-disable @typescript-eslint/no-require-imports */
779 const { sendToUdsSocket } =
780 require('../../utils/udsClient.js') as typeof import('../../utils/udsClient.js')
781 /* eslint-enable @typescript-eslint/no-require-imports */
782 try {
783 await sendToUdsSocket(addr.target, input.message)
784 const preview = input.summary || truncate(input.message, 50)
785 return {
786 data: {
787 success: true,
788 message: `“${preview}” → ${input.to}`,
789 },
790 }
791 } catch (e) {
792 return {
793 data: {
794 success: false,
795 message: `Failed to send to ${input.to}: ${errorMessage(e)}`,
796 },
797 }
798 }
799 }
800 }

Callers

nothing calls this directly

Calls 15

parseAddressFunction · 0.85
getReplBridgeHandleFunction · 0.85
toAgentIdFunction · 0.85
isLocalAgentTaskFunction · 0.85
isMainSessionTaskFunction · 0.85
queuePendingMessageFunction · 0.85
resumeAgentBackgroundFunction · 0.85
handleBroadcastFunction · 0.85
handleMessageFunction · 0.85
handleShutdownRequestFunction · 0.85
handleShutdownApprovalFunction · 0.85
handleShutdownRejectionFunction · 0.85

Tested by

no test coverage detected